Gedden
05-26-2011, 11:52 AM
I am having a little trouble figuring out the proper syntax for what I want to do. What I *really want is the equivalent of the 'instanceof' operator in Java.
What I am trying to do:
Basically I want to get 'the world' under my mouse, which may be a BSP, height map, static mesh... (basically *not a skeletalmesh).
I noticed that all Objects have a Class member/reference. However I seem to be having an issue with the syntax... The following code does not compile, and im not exactly sure how to compare classes, or find out if a specific actors class inherits ...
simulated function GetWorldUnderMouse(out Vector hitLocation, out Actor TraceActor)
{
local Vector hitNormal;
foreach TraceActors(class'Actor',TraceActor, hitLocation, hitNormal, mouse3D + worldDireciton * 5000, mouse3D )
{
if( TraceActor == WorldInfo || TraceActor.Class == StaticMeshActor )
return;
}
TraceActor = none;
}
I realize I could accomplish this task by doing three raycasts, on class'Actor' and check for worldinfo (for bsp), on class'StaticMeshActor' and whatever actor a terrain is.. however that seems wasteful.
What I am trying to do:
Basically I want to get 'the world' under my mouse, which may be a BSP, height map, static mesh... (basically *not a skeletalmesh).
I noticed that all Objects have a Class member/reference. However I seem to be having an issue with the syntax... The following code does not compile, and im not exactly sure how to compare classes, or find out if a specific actors class inherits ...
simulated function GetWorldUnderMouse(out Vector hitLocation, out Actor TraceActor)
{
local Vector hitNormal;
foreach TraceActors(class'Actor',TraceActor, hitLocation, hitNormal, mouse3D + worldDireciton * 5000, mouse3D )
{
if( TraceActor == WorldInfo || TraceActor.Class == StaticMeshActor )
return;
}
TraceActor = none;
}
I realize I could accomplish this task by doing three raycasts, on class'Actor' and check for worldinfo (for bsp), on class'StaticMeshActor' and whatever actor a terrain is.. however that seems wasteful.