x


Plane.Raycast questions.

Hello. I want to create a swinging mechanic like this, where hook shoots out from the player at a 45 degree angle and the character can swing on it (my game idea is also 2D). Anyways, after asking around, I was told that a way I could accomplish this was to use Plane.Raycast from the player character, check to see if the ray hits an object that the player is able to hook onto, and have my hinge joint put there, how would I do this? specifically, how would I use the raycast to check the object it may be hitting and then, move my hinge to that point?

Thanks

more ▼

asked Feb 23, 2011 at 06:52 AM

Tyler 2 gravatar image

Tyler 2
1.1k 637 466 473

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I would suggest to use Physics.Raycast instead of the (limited) Plane.Raycast, because you can get all necessary information from RaycastHit.
Especially for placing the joint you get RaycastHit.point and RaycastHit.normal.

more ▼

answered Feb 23, 2011 at 12:29 PM

efge gravatar image

efge
5.3k 20 22 53

Okay, how would I do that?

Feb 23, 2011 at 10:02 PM Tyler 2
(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x3144
x2826
x49

asked: Feb 23, 2011 at 06:52 AM

Seen: 2383 times

Last Updated: Feb 23, 2011 at 06:52 AM