- Home /
Question by
Hexer · Apr 29, 2014 at 07:43 PM ·
javascriptrigidbody2diskinematic
How to set .isKinematic=false; on object in a script that is not attached to the object
Well I have been using this line .. all the time when enable or disable a component. It works with all components that can be flagged on and off. But Rigidbody2d doesn't have that kind of a thing and I want to disable isKinematic if the mouse is clicked.
The script should look something like this.
function OnMouseDown() {
Debug.Log("I have no Idea what Im doing");
GameObject.Find("Player").GetComponent(isKinematic).enabled=false;
}
So what am I missing?
Comment
Best Answer
Answer by tanoshimi · Apr 29, 2014 at 07:55 PM
isKinematic is not the component - RigidBody is the component, and isKinematic is a property of that component:
GameObject.Find("Player").GetComponent(RigidBody).isKinematic = false;
Your answer
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Get all child not working? 1 Answer
AddTorque Isn't Working? 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Problem with a RigidBody and IsKinematic... I think 1 Answer