hi everyone,
i have the script, move around. and, with the videos of TornadoTwins,
i learn how put the bullit prefab in the script, but i don’t know the button to
shot the bullit, and i want to know if its possible know the button seeing the script
here it is
but appear this error:
NullReferenceException
MoveAround.Update () (at Assets/Scripts/Mouse Scripts/MoveAround.js:26)
(I dont know how put the script in the window like the others in forum)
var speed = 3.0;
var rotateSpeed = 3.0;
var bullitPrefab:Transform;
private var dead = false;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == “fallout”)
{
dead = true;
}
}
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);
if(Input.GetButtonDown(“Jump”))
{
var bullit = Instantiate(bullitPrefab,
GameObject.Find(“spawnPoint”).transform.position,
Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 2000);
}
}
function LateUpdate()
{
if(dead)
{
transform.position = Vector3(0,4,0);
gameObject.Find(“Main Camera”).transform.position = Vector3(0,4,-10);
dead = false;
}
}
@script RequireComponent(CharacterController)
thanks