Raycast end or Actor.Direction point to the global zero

Hello Together,

i have an issue to with the tutorial " How to use raycasting"

i use the same code for all the spheres and the cone.
Then tried around a bit and just a test line in “OnUpdate” it was ok:

DebugDraw.DrawLine(new Vector3(0, 50, 0), new Vector3(0, 50, 100), Color.Red);

but all the others was the end pointing to the global 0, 0, 0?

if (Physics.RayCast(Actor.Position, Actor.Direction, out hit))
{
DebugDraw.DrawSphere(new BoundingSphere(hit.Point, 50), Color.Green);
}
DebugDraw.DrawLine(Actor.Position, Actor.Direction, Color.Red);

grafik
the Actor direction was not roeking at any position.

did i miss one point?

Ok it work fine!

if (Physics.RayCast(Actor.Position, Actor.Direction, out hit))
{
DebugDraw.DrawSphere(new BoundingSphere(hit.Point, 50), Color.Green); //hit point
DebugDraw.DrawLine(Actor.Position, hit.Point, Color.Green); //line from actor to Hit point
}
DebugDraw.DrawLine(Actor.Position, Actor.Direction, Color.Red);

the “Direction” is in Z+

grafik

now i get an other qustion:
is it posiible to get the up, right and front vector of the actor?

var up = Vector3.Up * actor.Orientation;

Hello mafiesto4,

THX for the fast answer

        DebugDraw.DrawLine(Actor.Position, (Vector3.Forward * Actor.Orientation) * 50 + Actor.Position, Color.Blue);        //Z
        DebugDraw.DrawLine(Actor.Position, (Vector3.Backward * Actor.Orientation) * 50 + Actor.Position, Color.DarkBlue);   //Z-
        DebugDraw.DrawLine(Actor.Position, (Vector3.Right * Actor.Orientation) * 50 + Actor.Position, Color.Red);           //X
        DebugDraw.DrawLine(Actor.Position, (Vector3.Left * Actor.Orientation) * 50 + Actor.Position, Color.DarkRed);        //X-
        DebugDraw.DrawLine(Actor.Position, (Vector3.Up * Actor.Orientation) * 50 + Actor.Position, Color.Green);            //y
        DebugDraw.DrawLine(Actor.Position, (Vector3.Down * Actor.Orientation) * 50 + Actor.Position, Color.DarkGreen);      //Y-

grafik