I can't seem to get the simple tutorial working with JavaScript.
#pragma strict
var rb;
function Start () {
rb = GetComponent('');
}
function FixedUpdate () {
var moveHorizontal = Input.GetAxis("Horizontal");
var moveVertical = Input.GetAxis("Vertical");
var movement = new Vector3(moveHorizontal, 0, moveVertical);
rb.AddForce(movement);
}
keeps outputting: `Assets/PlayerController.js(15,12): BCE0019: 'AddForce' is not a member of 'Object'.`
Perhaps it's my `GetComponent` usage?
I'd appreciate some help.
EDIT: Doesn't work either with `rb = GetComponent('RigidBody');`
↧