x


Grappling Hook Script

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.

more ▼

asked Jan 26 '12 at 01:11 AM

donncharedbeard gravatar image

donncharedbeard
1 1 1 1

Where do you set up what 'collider' is?

Jan 26 '12 at 01:16 AM syclamoth

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.

Jan 26 '12 at 05:48 AM donncharedbeard
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5098
x275
x11

asked: Jan 26 '12 at 01:11 AM

Seen: 904 times

Last Updated: Jan 26 '12 at 05:48 AM