Physics v2 fixed dimensions

Hi folks,

I’m porting all my games to Havok, and I found that most of the games hold one of the dimensions constant (e.g. y dimension in games without gravity, z dimension in “2d” platformers, also specific objects within other games). This happens every frame under my Ammo implementation. Under Physics V2, the affordance for this is to keep disablePreStep turned off, which seems like it might be a waste. Would it be better to use a 6DOF constraint for this? I’m aware of angular inertia, but is there the same concept for the linear dimensions? Any other suggestions?

Hmmm you could set the linear velocity of the bodies each frame to 0 on the constant dimension, but I’m not sure that would be any faster than disablePreStep? @eoin

There’s no linear equivalent to the inertia tensor’s behaviour of being able to prevent movement along one axis, so adding a 6DOF constraint and making one of the axes locked is the best bet.

The other options wouldn’t be great for different reasons - manually updating transforms will have an effect on performance, as it’s equivalent to teleporting a body, which means we can’t cache some data, while setting the linear velocity to 0 would still allow the solver to apply impulses along that axis during the step.