Question by
KeithorKeith · Apr 25, 2016 at 02:33 AM ·
codepagelift
Help with code for picking up objects
I'm following this tutorial: https://www.youtube.com/watch?v=XxNhYmR6Gwo But for some reason my objects just fall to the ground when i click them.... driving me insane.
Here is the code i'm using:
var onhand : Transform;
function update () {
}
function OnMourseDown () {
GetComponent.<Rigidbody>().useGravity = false;
this.transform.position = onhand.position;
this.transform.parent = GameObject.Find("FPSController").transform;
this.transform.parent = GameObject.Find("FirstPersonCharacter").transform;
}
function OnMouseUp () {
this.transform.parent = null;
GetComponent.<Rigidbody>().useGravity = true;
}
Thanks for your help
Comment
Answer by jgodfrey · Apr 25, 2016 at 02:49 AM
The most obvious problem is a typo here:
function OnMourseDown () {
That should be
function OnMouseDown () {
Your answer
Follow this Question
Related Questions
EventSystemChecker.cs(18,29): error CS0131 1 Answer
how to make a pickup 0 Answers
What is wrong with this why can't i move? 0 Answers
Am I stupid ? 1 Answer
how do I fix this code? it says I have an extra { symbol near the bottom. 1 Answer