example which i hv tried…now only one sphere is appearing and is moving in straight direction …now i want sphere objects to appear one after another like fruit ninja game…plz help me …here is code
private var controller :CharacterController;
controller = gameObject.GetComponent(CharacterController);
private var moveDirection = Vector3.zero;
private var forward = Vector3.zero;
private var right = Vector3.zero;
var speed :float= 5.0;
function Update()
{
transform.Translate(Vector3(0,0,-speed) * Time.deltaTime);
forward = transform.forward;
right = Vector3(forward.z, 0, -forward.x);
var horizontalInput = Input.GetAxisRaw(“Horizontal”);
var verticalInput = Input.GetAxisRaw(“Vertical”);
var targetDirection = horizontalInput * right + verticalInput * forward;
moveDirection = Vector3.RotateTowards(moveDirection, targetDirection, 200 * Mathf.Deg2Rad * Time.deltaTime, 1000);
var movement = moveDirection * Time.deltaTime * 2;
controller.Move(movement);
transform.rotation = Quaternion.LookRotation(moveDirection);
if (targetDirection == Vector3.zero)
{
transform.rotation = Quaternion.LookRotation(moveDirection);
}
Destroy (gameObject,7);
}
@script RequireComponent(CharacterController)