I made a script to change a gameobject when in a trigger collider and when I pressed "e". I had an earlier script that changed its position but it was not on trigger but just when I pressed "e". Here's the script:
var Skull : GameObject;
var x = 0.0;
var y = 0.0;
var z = 0.0;
function OnTriggerEnter (other : Collider) {
Skull = GameObject.Find("Skull");
}
function Update() {
if (Input.GetKeyDown("e"))
Skull.transform.position = Vector3(x, y, z);
}
I need to have the player find the skull, have the collider that is in front of the player have the skull inside of it, and the player to press "e" to move its position. Please help and thank you.
↧