About Store Forum Documentation Contact



Post Reply 
[ANDROID] Dynamic created physics body is ignored
Author Message
cat555 Offline
Member

Post: #1
[ANDROID] Dynamic created physics body is ignored
Hi, i'm creating the following object. Problem is that, in Android actors don't collide with this object, but in Linux all works fine as expected in terms of collision...

Am i forgetting something specific for the Android platform?

Code:
GroundObj : Game.Static
{
   MeshBase base;

   void create(Game.ObjParams &obj)
   {
      super.create(obj);
      
      //base.create(*T.mesh, ~0 , true);
      base.createPhys(*T.mesh,  VTX_POS|FACE_ID, true);
      PhysPart part;
      part.createMesh(base, true);

      actor.create(part);
      actor.matrix(T.matrixScaled());
      actor.group(AG_GROUND);
   }
}

Regards,
01-26-2015 03:11 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: [ANDROID] Dynamic created physics body is ignored
Hi,

actor.matrix does not accept scaled matrixes (its length should be = 1), if you need scaling, then you can scale the physical body.
Hope this solves the issue.
01-27-2015 03:47 AM
Find all posts by this user Quote this message in a reply
cat555 Offline
Member

Post: #3
RE: [ANDROID] Dynamic created physics body is ignored
Hi @Esenthel,

I didn't noticed your feedback :\

I'm working again on this part of my game, and can't fix this... i don't know what you mean, since actor.matrix(T.matrixScaled()); is actually working as i expected to work. I can see with Physics.draw(); that physical body is actually positioned has it appears in the World Editor.

So, the GroundObject class i mentioned works quite well, except on Android... that i cannot understand.

If i use Physics.draw(); when running on Android, i can't see the physical object... my guess is that it's not being created in Android for some reason :(

Why this works in Linux platform and not in Android? How to overcome this behavior?

Also, i tried this with success in Linux and without success in Android (just same problem):

Code:
void create(Game.ObjParams &obj)
{
      super.create(obj);
      
      //base.create(*T.mesh, ~0 , true);
      base.createPhys(*T.mesh,  VTX_POS|FACE_ID, true);
      //mesh->setBase();
      PhysPart part;
      part.createMesh(base, true);

      part.transform(T.matrixScaled());
      actor.create(part);
      //actor.create(*phys);
      //actor.matrix(T.matrixScaled());
      actor.group(AG_GROUND);
}

Thanks!
(This post was last modified: 04-23-2015 02:45 PM by cat555.)
04-23-2015 12:58 AM
Find all posts by this user Quote this message in a reply
cat555 Offline
Member

Post: #4
RE: [ANDROID] Dynamic created physics body is ignored
I've been testing actor that is created and it is created and correct positioned, even on Android... but for some reason, is if not being there...

Code:
void create(Game.ObjParams &obj)
{
      super.create(obj);
      
      base.createPhys(*T.mesh,  VTX_POS|FACE_ID, true);
      PhysPart part;
      part.createMesh(base, true);

      actor.create(part);
      actor.matrix(T.matrixScaled());
      Log(S + "Ground tile pos: " + actor.pos() + "\n");
      actor.group(AG_GROUND);
}

... when i execute Physics.draw(), those actors are not displayed (again, only on android)... but i've changed code to this so i can log all actor positions, and positions are correct... those actors exists, but they don't collide, and not show within physics debug...
04-23-2015 03:08 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: [ANDROID] Dynamic created physics body is ignored
Hello,

You can't set a scaled matrix to Actor.matrix, it must be uniform length.
04-23-2015 11:35 PM
Find all posts by this user Quote this message in a reply
cat555 Offline
Member

Post: #6
RE: [ANDROID] Dynamic created physics body is ignored
(04-23-2015 11:35 PM)Esenthel Wrote:  Hello,

You can't set a scaled matrix to Actor.matrix, it must be uniform length.

Hi @Esenthel,

Ok, i accept that (but why it works on Linux?)... i've now took off "actor.matrix(T.matrixScaled());", but the problem still exists -> on Android, those actors are not being shown (checked with physics debug), so no collisions.... in Linux they appear fine again.

Code:
void create(Game.ObjParams &obj)
   {
      super.create(obj);
      
      base.createPhys(*T.mesh, VTX_POS|FACE_ID, true);
      PhysPart part;
      part.createMesh(base, true);

      actor.create(part);
      actor.group(AG_GROUND);
   }

Any clue please, of how can i overcome this issue?

Thanks!
04-24-2015 09:31 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: [ANDROID] Dynamic created physics body is ignored
Hello,

Could you please attach a small *.EsenthelProject with the issue reproduced?
Thank you
04-24-2015 10:42 PM
Find all posts by this user Quote this message in a reply
cat555 Offline
Member

Post: #8
RE: [ANDROID] Dynamic created physics body is ignored
(04-24-2015 10:42 PM)Esenthel Wrote:  Hello,

Could you please attach a small *.EsenthelProject with the issue reproduced?
Thank you

Hi @Esenthel,

I attached a small test project for you to test.

You can see that in Linux, objects fall on the ground and collide with it, but in Android, objects don't collide with ground, because ground physics object just isn't there...

Thanks for your time analyzing this issue!


Attached File(s)
.zip  cat555_test1.EsenthelProject.zip (Size: 329.87 KB / Downloads: 2)
04-27-2015 11:32 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: [ANDROID] Dynamic created physics body is ignored
Hello,

You're using
APP_AUTO_FREE_MESH_OPEN_GL_ES_DATA
which disables accessing the mesh data, which makes this:
base.createPhys(*T.mesh, VTX_POS|FACE_ID, true);
to fail.

Btw. it should be VTX_POS|FACE_IND not FACE_ID
04-28-2015 01:18 AM
Find all posts by this user Quote this message in a reply
cat555 Offline
Member

Post: #10
RE: [ANDROID] Dynamic created physics body is ignored
(04-28-2015 01:18 AM)Esenthel Wrote:  Hello,

You're using
APP_AUTO_FREE_MESH_OPEN_GL_ES_DATA
which disables accessing the mesh data, which makes this:
base.createPhys(*T.mesh, VTX_POS|FACE_ID, true);
to fail.

Btw. it should be VTX_POS|FACE_IND not FACE_ID

Hi @Esenthel,

I removed APP_AUTO_FREE_MESH_OPEN_GL_ES_DATA and now it works perfectly smile

Many thanks for your help!
04-28-2015 10:16 AM
Find all posts by this user Quote this message in a reply
Post Reply