set velocity/rotation to 0?

I’m using python, and am controlling the velocity via setLinearVelocity() and setAngularVelocity(). I want to instantly stop a physics object. (linear velocity has been solved, but I still need to stop angular velocity)
the problem is, a value of 0 is seen as not setting anything, rather than setting it to 0. I can’t just set to a very small value because any motion breaks static friction (damn you, physics ^^). There’s at least one other thread on BA (pretty old) with this issue, but it’s unsolved. and closed.

so the question is, if I can’t use 0 when setting angV (linV has the same problem), how can I set it to 0?

Setting it to zero should stop applying velocity, but it will still take some time for the object to reach a dead stop. If that doesn’t work, then try disabling the actuator itself.

Or are you trying to get an instant stop? <- If that’s the case, then I would recommend using applyImpulse with all the parameters set to counter current velocities.

yeah, I’m trying to get an instant stop (sorry, I was unclear, I’ll edit the original post).
my main problem is angular velocity- would an impulse still work? how might I use it to counter rotation if it does work? (thanks for pointing it out to me though, I had forgotten about impulse)

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.

unfortunately, I have even more details to add to the mix.
A) it’s the main character, adding/removing adds even more mess than something without a camera parented to it and such
B)it’s not rigid body. you’d think I would have told you this earlier, but my mind doesn’t work that well ^^
C) I need to be able to stop angular and linear velocities independently, and sometimes only on certain axes.
D) my education only goes up through high school mechanical physics, so I already have a very vague and limited understanding of most of the math I’m using. add more vector math and such, and there’s a danger of spontaneous head exploding (I have a problem wherein I freak out if I don’t understand the concepts behind something I’m using, regardless of whether I need to know it or not)

for the moment I just have rotational damping at full, since that at least allows me to tweak away at other problems without this one getting too much in the way. and boy, do I have other problems (let’s just say that it’ll be a good long while until I’m comfortable with using the orientation matrix)

oh, before I forget: thanks for spending the time to help, I appreciate it.

Not that I have any idea about most of the stuff you guys are talking about, but can’t you just use Python to get the object’s angular velocity, and then go back and set that as a negative?

yeah good luck!!! As Social (that’s a cool method by the way… been trying to figure a fix for ages) mentioned it’s a major pain… cos you can’t get the friggin angular velocity… so you can stop it… but if it’s spinning… it keeps the spin… kinda weird to watch. And no you can’t acces it via python…

maybe you could do an instance replace instead of adding the object from another layer. eg. you have two models (with riggin etc) in the scene… the one under the ground plane or something…and the one walking around and then swap from one to the other using Socials method. Because it’s not added from another layer… it should work? but each method has it’s own set of problems.

but what we really nead is a python function we can use!! would make life simpler… ;-(

Well, as both I and kirado already mentioned, there seems to be no way one can get AV (Angular Velocity).

However, even if we could, you can’t counteract AV with an actuator. I ran tests where I had the object start with an AV of (0,1,0,0) and then I tried to counter it with (0,-1,0,0), but instead of returning to zero AV was now just -1.

So no.

Captain Oblivion>

Wow, that’s quite a few problems you have there. I hope you can figure something out in the end.

Good Luck!

actually, if I could get the angV, I could set the torque to negative (the mass is 1, so moment of inertia shouldn’t matter- I hope)
[edit] damn, I just remembered that the radius also affects it…