Infinite inertia = never sleep?

Official forum for the Chipmunk2D Physics Library.

Infinite inertia = never sleep?

Postby Paril » Mon Feb 15, 2016 6:53 am

I ran into a little issue with something I'm trying out.

So basically, I'm trying to make a vehicle that is good at climbing steep terrain; I've been playing with frictions and velocity callbacks to try to aid this (applying damping to the vehicle & wheels if they are stopped on a hill to mimic breaks, stuff like that). I've got two main issues with what I'm doing, and am interested in hearing any potential ideas.

First issue is that it's near impossible to begin to gain traction and speed on an upward hill if you have no initial velocity on the hill. I can, of course, crank up the torque, but then the wheels end up going too fast on regular or downward ground. My best guess so far is just to change the amount of torque based on the normal of the contacts, but does any one have any better way to implement breaking on hills like that?

Secondly, it seems that if a shape has infinite inertia, it never sleeps. I thought maybe if I prevented the wheels from rotating by setting their I to infinity, it would help mimic real-life breaking and allow traction to do the rest of the work, but it seems that it also makes the calculation for sleeping completely break. It looks like infinite mass was handled in the source, but not infinite inertia. Is this a bug, or intentional?
Posts: 1
Joined: Mon Feb 15, 2016 6:48 am

Re: Infinite inertia = never sleep?

Postby slembcke » Mon Feb 15, 2016 9:53 am

Are you setting the torque force directly on the wheels? You'll have a much better simulation if you use cpSimpleMotor constraint. The motor lets you set the maximum speed and torque the motor will allow. You can vary the torque based on the speed for a more authentic motor feel. (max torque at zero speed, 0 torque at maximum speed)

Infinite moment and sleeping:
An object with infinite mass cannot be stopped or moved period. An object with an infinite moment can slow down and stop, it just won't rotate. There are a few odd, unhandled cases like an infinite moment with a finite mass, etc. Those don't really apply in this case though.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! ->
User avatar
Site Admin
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 1 guest