Jump to content
  • Advertisement
Sign in to follow this  
leandro81

Weird problem with PhysX

This topic is 3771 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!