- Home /
Rigidbody isKinematic on mouse click
Hoy, I'm trying to make a gameobject react to physics on a mouse click. I have my visible mesh with 4 box colliders as children.
I am able to get the mesh to change colour as I hover the mouse over it, but when I tell it to make 'rigidbody.isKinematic = false' on click the checkbox becomes unchecked (false) in the inspector but the mesh does not move at all or react to physics.
I suspect this is because the mouse click is registered on the box colliders(children), not the visible mesh (parent to colliders). Do I need to send the message back to the parent somehow?? (The script is attached to the parent object)
Any help would be appreciated
Answer by operand · Dec 12, 2011 at 08:31 AM
I've since solved the issue. Placing rigidbody.WakeUp() at the end of the script has done the trick.
Answer by funkyllama · Dec 11, 2011 at 02:48 PM
If the checkbox is becoming unchecked then the script is working. If your mesh still doesn't move I'd take a guess and say you have kinematic rigidbodies on your colliders also.
Hrrm. The colliders have no rigidbodies assigned to them individually, only the parent does. When the scene plays and I just uncheck 'Is $$anonymous$$inematic' for the parent gameobject in the inspector it falls to the ground correctly, however if I only uncheck it through script nothing happens in the scene. Do the physics need to re-update or something?
Your answer
Follow this Question
Related Questions
Kinematics: Trying to get an object to land at a known point 1 Answer
Rigidbody hinged to moving kinematic rigidbody is NOT constrained 0 Answers
Move object towards mouse but if mouse moves object fallows it's original path 0 Answers
How to detect double and single clicks using javascript? 1 Answer
Player to look at 0 Answers