I can't seem to figure out how to do this. I've checked the documentation, but it doesn't really explain how to do it. This is the script I'm using right now:
var speed : int = 10;
function Update ()
{
rigidbody2D.AddForce(transform.forward * speed * Time.deltaTime);
}
It seems like it should be pretty simple. With this code, I'm not getting an error, but the object isn't moving at all when it spawns. I've also tried to capitalize Rigidbody2D, 'cause I'm a little unclear on how it is supposed to be capitalized, but when I do that it gives me this error:
**An instance of type 'UnityEngine.Rigidbody2D' is required to access non static member 'AddForce'.**
So I'm pretty sure the one without capitalization is correct. But it still isn't moving? Could anybody help me understand why it isn't moving and how I should go about fixing it? Thanks in advance for anybody's help.
↧