Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Darnen on April 24, 2011, 04:30:34 AM

Title: Rotating the Raycast with a GameObjects Direction?
Post by: Darnen on April 24, 2011, 04:30:34 AM
I am having a mind boggling time trying to figure how to rotate a raycast with a Characters (GameObject) field of view. For example I am trying to make it so when the player comes into view of the enemies vision the enemy becomes alerted and chases after the player. I have everything setup right except for the Raycast, it can only be set to a vector3 'direction' and not the characters 'rotation' that I know of. Is this even possible? Or am I needing to do it a different way, any help would be much appreciated.

P.S
I am also trying to make it so the enemies field of view is set to a certain distance (Obviously) I have set a variable that stores the distance that I want, so far the player is not spotted until he enters the max range but the enemy will continue to follow him indefinitely regardless if he is out of range or not.

Thank
Title: Re: Rotating the Raycast with a GameObjects Direction?
Post by: Alex Chouls on April 26, 2011, 02:49:48 PM
Raycast takes a world direction vector. Use Transform Direction to convert a local direction vector to a world direction vector. I'll probably add some options to Raycast to simplify this...
Title: Re: Rotating the Raycast with a GameObjects Direction?
Post by: Darnen on April 26, 2011, 10:23:38 PM
Hmm, alright I will mess around with it some more. Thanks for the reply!