I am trying to create a script that when the mouse is pressed moves a rigidbody. I have consulted the unity documentation on Rigidbody2D.MovePostion and I am still getting an error. I am wondering what I'm doing wrong and how I can fix it. If anyone has any help that would be greatly appreciated. Thanks in advance.
Here is what I have for code:
var Velocity : Vector2;
var Object : Rigidbody2D ;
function Start () {
Object = GetComponent.();
}
function Update () {
if (Input.GetMouseButton(0))
{
Frame.MovePosition(RearWheel.position + Velocity * Time.fixedDeltaTime);
}
}
↧