When it comes to linear velocity, applyImpluse works perfect. No such luck with Angular Velocity though. The documentation states that Angular Velocity can be effected by applyImplulse, given that the “point” of impulse is something other than it’s current position, and that the object in question has “Rigid Body” enabled.
Now, I thought there could be some math I could do here that would allow me to stop both Linear and Angular velocity with applyImpulse, but I couldn’t:
- Find a way to get current Angular Velocity (nothing through own like with velocity, only the actuator value - which is static - is available)
- Rely on the reliability of applyImpulse to make correct changes in Angular Velocity (because setting impulse point to own.getPosition() shouldn’t have made any changes to Angular Velocity according to the docs — but it made the whole thing just freak out. So that made me doubt the validity of this approach as a potential solution…at least for version 2.45…It’s fucked up.
Anyway, it all really comes down to what you want to do here exactly. If you want to make something along the lines of a “time freeze”, then there is no need to do any of this, because you can just use suspend/restoreDynamics().
I doubt that’s what you want though, because you would have figured that out on your own.
In that case, there is an option I’v been thinking about. It’s a little dirty, and it might not work in your particular situation, but it’s better than nothing:
Simply have your object store it’s position & orientation information at the moment of the stop into global variables, end that object, add a copy of the same object from layer 2, apply the position & orientation data to that copy —> and hopefully you end up with an illusion of “dead stop” Linear & Angular velocities.
…Come to think of it, calling this “dirty” is an understatement.
Well, tell me what you come up with.