|
I am working on a grappling hook mechanic for a simple game, and am having trouble with the script. The script is as follows (so far): var destination: Transform; function Update () { if(Input.GetButtonDown("Fire1")) { animation.Play("Fire"); if (collider.gameObject.tag=="GrapplePoint"){ collider.transform.position = destination.position; // teleports object collider.transform.rotation = destination.rotation; // makes it face the correct side } else{ animation.Play("Retract"); } } } function OnControllerColliderHit(collider:Collision){ } When I fire the the grappling hook gun, it goes straight to the "Retract" command. I need the gun to hit the tagged (and yes I'm positive it's all properly tagged) object, and "Teleport" the FPC to the area. I know what it needs to do, I'm just having trouble getting it to work. Any help would be appreciated.
(comments are locked)
|

Where do you set up what 'collider' is?
I don't, and that's where my confusion comes in, I'm not 100% sure where to put it in, and I don't know if I'm missing something else. I'm not sure what, but I can tell that I am.