Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local Center of Mass Modification In Contact Modifier Callback #60

Closed
WombatZilla opened this issue Dec 21, 2017 · 4 comments
Closed

Local Center of Mass Modification In Contact Modifier Callback #60

WombatZilla opened this issue Dec 21, 2017 · 4 comments

Comments

@WombatZilla
Copy link

Hi,

I have a quick question regarding the contact modifier callback. Is it possible to modify the local position of the center of mass on a body in this callback. I am working on some car physics and would like to have a low center of mass on my vehicles while driving so that they have a better driving response but then temporarily shift up the center of mass during collisions so that the solver doesn't generate torques that "ride" the car up a wall due to the low center of mass.

This feature is available in Havok and I think a number of other physics engines also have something similar?

Cheers,

Richard Hunton
EA Firemonkeys

@rknoesel
Copy link

rknoesel commented Dec 21, 2017 via email

@WombatZilla
Copy link
Author

In my case this is an interesting suggestion but not really what I'm after.

I would like PhysX to step the physics forward on my cars using all the forces and torques I have applied during my car physics calculations (tire lateral / longitudinal grip, suspension, roll bars, aero, drag, rolling resistance, etc) using the lower center of mass but resolve any collisions / contact points in the solver using an offset COM.

Cheers,

Richard Hunton
EA Firemonkeys

@kstorey-nvidia
Copy link

You can modify the location of the contacts during contact modification. This would allow you to move the contact more in-line with your car's COM. Could you try using this to see if you can achieve an acceptable result?

PhysX also provides a mechanism to locally adjust the mass/inertia of the colliding bodies. You can't explicitly modify the values in the inertia tensor but you are provided scales that you can use to scale the inverse mass or inverse inertia of the bodies to tweak the way collisions are handled. This may also be a useful feature for you.

Its not currently possible to adjust the location of the COM of the bodies in the contact solver. It probably wouldn't be very difficult to add, either as an extension to contact mod or as a new property of the rigid bodies.

Assuming the COM is low (e.g. some point below the chassis of the vehicle, outside of the collision geometry), if the vehicle left the ground and began tumbling, the motion would look quite unusual because integration will occur around the COM causing the vehicle to appear to orbit a point outside the chassis.

@WombatZilla
Copy link
Author

Thanks for the response. I will try moving the contacts during collision to see if this gives me some interesting results. We are currently using mass, inertia, friction and restitution modifiers in the contact modifier callback and these make the collisions a lot less punishing.

Like you say putting the COM outside the collision geometry would look and behave a bit strange. We are currently running our vehicles with lowish COM's but they are still above the bottom of the car's collision shape. My thought was to run with this low COM for normal driving and then move the COM up during collisions and also when "tumbling" in crash mode,

My current nasty collision response case in on highly cambered sweeping corners with vertical walls at the top of the corner. Hitting these walls at a glancing angle at high speed is pretty nasty,

If adjusting the COM in the contact modifier callback was a simple change I'd love to have a patch to try out locally :)

But for the moment I'll try moving the contact points and also will have a close look at what our suspension simulation code (springs, dampers, roll bars, bump stops) is doing during high speed collisions.

Cheers,

Richard Hunton
EA Firemonkeys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants