OK, I’m just a beginner, so don’t expect me to know much about JavaScript.
I’m trying to get this script to work, the movement already works, but the addForce part doesn’t. I can play without errors but whenever I press spacebar, my character doesn’t jump. I’m trying to do a bird-themed game, so whenever I add force to th object, it doesn’t need to be on the ground. Thanks!
var speed = 7.0; var rotateSpeed = 3.0;
var flap;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical"); controller.SimpleMove(forward * curSpeed);
flap = (Input.GetButtonDown("Jump"));
rigidbody.AddForce (Vector3.up * 200);
} ;