Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: markinjapan on January 15, 2012, 04:41:07 PM

Title: How to Raycast at an angle? [SOLVED]
Post by: markinjapan on January 15, 2012, 04:41:07 PM
This is probably really, really easy or really hard. Either way I'm missing it :(

I'm trying to raycast from a gameobject but at a slight angle. I see in the Raycast action there is a direction box so I thought I could simply put a rotation vector in there (like 0,45,0), but it's there wrong type as it's drawing a line in Y with length 45. Not what I wanted.

I guess my question is, how can I convert an rotation Vector3 angle (like 0,45,0) into a direction Vector3?

Is there something I'm missing?

If not, then a Convert Rotation to Direction action would be great :)

Thanks
Title: Re: How to Raycast at an angle?
Post by: Alex Chouls on January 15, 2012, 09:11:17 PM
The Direction parameter in Raycast is in world space. I've been meaning to add a local choice to this action for a while...

In the meantime, you can use the Transform Direction action to transform a local direction vector to world space. E.g., 45 degrees is (1,0,1) as a direction vector.

Also check Debug in the Raycast action and Gizmos in the Game View to see the ray and make it easier to debug...

See the crappy attached screen  :-\
Title: Re: How to Raycast at an angle?
Post by: Alex Chouls on January 15, 2012, 09:38:12 PM
New version of Raycast:

http://hutonggames.com/playmakerforum/index.php?topic=1021.msg4214#msg4214