Monday, September 13, 2010

video #1

Here is a Java Scipt to make a game object move in unity:
To make this work you need to attack a character controller to the game object you want to controll

var speed = 3.0;
var rotateSpeed = 3.0;

function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);

// Rotate around y - axis
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);

// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);

}



@script RequireComponent(CharacterController)




Check out this dude he can tech you to make a cool videogame

llscreen="true" width="980" height="765">

No comments:

Post a Comment