About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
[RESOLVED] Misaligned physbody issue
Author Message
aceio76 Offline
Silver Supporter

Post: #1
[RESOLVED] Misaligned physbody issue
There is a difference between the placement of the physbody of an object set as "Embed into Terrain" and "Constant". The physbody of the object set as "Embed into Terrain" is in the correct position, where the physbody of the object set as "Constant" is offset lower than where it should be.


Attached File(s) Image(s)
           
(This post was last modified: 11-20-2012 01:19 AM by aceio76.)
07-28-2012 05:46 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Misaligned physbody issue
Are you using built-in Game::Static class for the OBJ_STATIC objects?

If you're using custom C++ class, then try Game::Static, if it works ok, then it means you have some incorrect codes in your custom static object class.

If you're using Game::Static then could you send me the object+mesh+phys files?
07-29-2012 04:45 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #3
RE: Misaligned physbody issue
I have tried going back to just using Game::ObjMemx<Game::Static> AllStatics; and I still have the same issue.

I basically just extend Game::Static anyway:
Code:
STRUCT (ObjPhysical , Game::Static)
and:
Code:
void ObjPhysical::create(Game::ObjParams &op)
{
   scale   =op.scale      ();
   phys    =op.phys       ();
  _matrix  =op.matrixFinal().normalize(); _matrix_scaled=_matrix; _matrix_scaled.scaleOrn(scale);

   if(phys) actor.create   (*phys, 0, scale)
                 .group    (AG_STATIC      )
                 .matrix   (_matrix        )
                 .obj      (this           );
}
Bool ObjPhysical::update()
{
   if(!phys) return false;
   return true;
}
UInt ObjPhysical::drawPrepare()
{
   return 0; // no additional render modes required
}

The offset is happening on some static objects set as Constant type with Align set to 'align Y to top'. it seems that the PhysBody is not aligning Y to top, in this case.

A few things specific to this project:
- I am not displaying any mesh, I'm only interested in the physbodies
- I have the Worldmanager set to WORLD_MANUAL
- I only call the update() function on the static objects once in Init()
- I still do call Physics.startSimulation().stopSimulation(); manually on main Update();

I've attached a mesh, obj and phys file that is exhibiting this issue.


Attached File(s)
.zip  IpocWall01.zip (Size: 5.64 KB / Downloads: 1)
07-29-2012 07:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Misaligned physbody issue
I've noticed that your files in the attachment are not the same as the one on the screenshot.
I've tried reproducing the issue but can't:
1. placed the object on the world
2. copied it next to the 1st one
3. set 1st access to Constant, set 2nd access to Embed
4. build and play world
5. physical bodies are correct

All done from the World Editor


Attached File(s) Image(s)
       
08-01-2012 12:56 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #5
RE: Misaligned physbody issue
I just wanted to update this post.

The issue has "mysteriously" been rectified. It was something I could reproduce *on specific objects/meshes* and could not identify what could be causing the issue. Now they are all working fine. Nothing was done via code to fix this issue or with the problematic objects/meshes to rectify this issue. The issues disappeared after the non-uniform scaling was introduced.

I can finally close this issue.
11-20-2012 01:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply