Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: joduffy on February 02, 2014, 01:03:44 AM

Title: Raycast not aligning up properly
Post by: joduffy on February 02, 2014, 01:03:44 AM
Hi guys,

I am trying to use the raycast to align between my main camera and the 3d object that I am using as a cursor.

But for some reason the ray doesnt pass through the cursor. It seems go in general direction but I am just confused why it is not passing thought the point.

What I want to do in the end is detect a point on the yellow plane and have an object move to that location.

Note If i use world over self the raycast is even worse.
Title: Re: Raycast not aligning up properly
Post by: jeanfabre on February 03, 2014, 05:25:25 AM
Hi,

 yes, you are likely not computing the direction vector properly.

The mouse position is expressed in screen coordinates, not in 3d coordinates.
 
So, for this, I would use the following scene as a starting point. It's a small sample showing how to have an object looking at the mouse, use this as your way to get the real direction in world of the mouse direction compared to another 3d object.

bye,

 Jean