How to obtain AnimatedEntity through ray? #3854
-
I've set But when I get the entity via I tried using The entity is inherited from AnimatedEntity and I've added the tag Here is my code: public static Vector3 GetCursorAtWorldPosition()
{
var ray = Screen.GetOrthoRay(Mouse.Position);
var result = Trace.Ray(ray, 5000).WithTag("solid").Run();
return result.Hit ? result.HitPosition : Vector3.Zero;
}
public static Entity GetCursorEntity()
{
var ray = Screen.GetOrthoRay(Mouse.Position);
var result = Trace.Ray( ray, 5000 ).WithTag("npc").RunAll();
foreach ( var r in result )
{
Log.Info(r);
}
if ( result.Length > 0 )
{
return result[0].Entity;
}
return null;
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've solved it, just need to set |
Beta Was this translation helpful? Give feedback.
I've solved it, just need to set
EnableHitboxes
to true, I thoughtEnableHitboxes
was true by default until I checked all the properties today and realized it wasn't!