Weird problem with PhysX

Started by
2 comments, last by jezham 16 years, 2 months ago
Hi, I am using PhysX to simulate simple rigid bodies and i am getting this weird problem: There is a plane and several objects placed on top of it; when i apply a force on one of them, the force direction gradually moves toward one of the axis: X or Z (depending on which one is closer to the original force direction), please look: Free Image Hosting at www.ImageShack.us I am using C# and PhysX:

Vector3 lookDirection = new Vector3();
lookDirection = currentCamera.LookAt.Position - currentCamera.Position;
lookDirection.Y = 0.0f; // removes the Y part, as i want to apply a horizontal force;
lookDirection.Normalize();
lookDirection = lookDirection * strength;
physicsManager.addForce(obj, lookDirection, currentCamera.LookAt.Position);

And inside physicsManager:

public void addForce(Object3D obj, Vector3 force, Vector3 pos)
{
    if (bodies.ContainsKey(obj))
    {
        NxActor actor = bodies[obj];                
        actor.addForceAtPos(force, pos, NxForceMode.NX_FORCE);                
    }
}

I don't know what could be causing this, or what i am doing wrong. Well, thanks in advance for any tips! :) Cheers, Leandro
<br/>GDNet journal: Endeavours On Managed Code Land
Advertisement
Unless this is happening in a hardware scene then you need to force cone friction, for the advanced friction model.

when creating actors, use this flag:
NX_AF_FORCE_CONE_FRICTION

or for the whole scene:
NX_SF_FORCE_CONE_FRICTION (in your sceneDesc.flags)
WOW! Thanks, this really seems to be the solution!

But now I have another problem, I am using this wrapper and it's linked against version 2.4.4 of PhysX library and this flag appeared only on version 2.6.1 :(

Does anyone know another .NET wrapper for a recent version of PhysX?

Thanks in advance,
Leandro
<br/>GDNet journal: Endeavours On Managed Code Land
Yeah the newer friction model has a real nice feel to it :)

Can't help with wrappers, perhaps start making your own as a side project, e.g. draw everything with the debug code to start, etc? It takes years though, I'm doing everything (within reason) custom and it feels like I'm doing a whole team's effort!

This topic is closed to new replies.

Advertisement