- Home /
Fix an object against forces
I have a hand of my player I can position somewhere in the world per drag and drop with a jointy arm on it (the players arm for egoview). Now, when I have positioned the hand, I want it to be fixed at that location for visual stability (the hand will grab there). But when I turn my player due to looking around, the joints of the arm adds a force to the hand and make it move/wobbling.
I've tried to make the hand isKinematic, to freeze it's position and rotation, iterate the position per script, increase mass and drag, set velocity/angularVelocity to Vector3.zero, lock the rotation per surface normal detection... nothing works.
How can I make it firm as a rock?
Answer by wibble82 · Dec 21, 2015 at 12:57 PM
Making the hand's rigid body have isKinematic=true is definitely the correct thing to do, though you may need to set its angular/linear velocity to 0 as well if it's already gained velocity.
If that's not working then perhaps something elsewhere in your game is changing its position/velocity/isKinematic setting?
The problem is, as soon i make the hand Is$$anonymous$$inematic = true, it starts to drift away from its position and the hand keeps its is$$anonymous$$inematic-state. Perhaps because it is a child of a non kinematic object?
I need the arm still movable...
That is surprising - it sounds like something else is changing its position a little bit each frame. Perhaps there are some subtle issues relating to the hierarchy but I wouldn't have thought so. Worth seeing what happens if you unparent it when you set it to kinematic though (just to see what happens).
I could do it by ripping the hand away from the arm (in the hierarchy). Thats bad just because of the way I have to handle it. $$anonymous$$eans a lot more variables to preset in the script just for one operation (I try to keep it as simple as possible).