I have an object that is a rigid body and has a Rigid Body Joint so it can rotate and react to gravity.
But now I want to suspend that for a while (If I press a button), so it doesn’t react to gravity anymore.
How should I do this?
I’ve tried doing it with getting the angular velocity and give it an angular velocity that’s the opposite of the one it already has. But this doesnt work so well…
I tried that, but it didn’t work, 'cause the RBjoint then also stops.
But I’ll give that another try then… Maby parent the cars to the cars for the duration of the brakes?
Now I have a new problem. The parenting action takes to long.
This is my code:
import GameLogic as g
cont = g.getCurrentController()
own = cont.getOwner()
jointsens = cont.getSensor("joint")
joint = jointsens.getOwner()
orien1 = own.localOrientation[0][0]-1
if own.mode == 1 and orien1 > -0.001 and orien1 < 0.001:
own.setParent(joint)
if own.mode == 0:
own.removeParent()
own.orien = own.localOrientation[0][0]-1
This should parent the car when it’s x-orientation is between -0.001 and 0.001 and mode is 1 (the brakes are on).
But when I tried it, it got parented at 0.9. Is this because parenting is slow?