PDA

View Full Version : How do i get a meshes details!!! HELP


widroy
31st Oct 2005, 06:58 PM
I am quite new to this coding in Unreal Script but i am getting there.

I have implemented the trace tutorial from the UDN website that will return a message to the HUD and also call up a texture when the trace hits a mesh/actor.

class RTTestInteraction extends Interaction;

function Initialized()
{
log(self@"i'm alive");
}

function PostRender( canvas Canvas )
{
simpleTracer(Canvas);
}

function simpleTracer(canvas Canvas)
{
local actor Other;
local vector HitLocation, HitNormal, StartTrace, EndTrace;
local vector ScreenLocation;
local PlayerController PlayerOwner;

PlayerOwner = ViewportOwner.Actor;

//Perform a trace to find any colliding actors
StartTrace = PlayerOwner.Pawn.Location;
StartTrace.Z += PlayerOwner.Pawn.BaseEyeHeight;
EndTrace = StartTrace + vector(PlayerOwner.Pawn.Rotation) * 1000.0;
Other = PlayerOwner.Pawn.Trace(HitLocation, HitNormal, EndTrace, StartTrace,True);


if (Other != None)
{
PlayerOwner.ClientMessage ("Hit:"@Other);
//Convert 3d location to 2d for display on the Canvas
ScreenLocation = WorldToScreen(Other.location);
Canvas.SetPos(ScreenLocation.X, ScreenLocation.Y);
Canvas.Style = 3;
Canvas.SetDrawColor(255,255,255);
Canvas.DrawTile(texture 'S_Actor', 84,84,0,0,84,84);
}
}

defaultproperties
{
bVisible=true
bActive=true
}



Please Help.
I need it to return the mesh objects name eg; farmhouse, stairs, wall, etc,.

and/or

I need to be able to say "if mesh/actor/object is "farmhouse" then show this texture"

please help!!!

Hazard.ep
1st Dec 2005, 03:09 AM
So your farmhouse/stairs ... is a static mesh actor? Then you have to use the returned TraceActor (or sth. like this) and check its StaticMesh variable. You could compare it to some other value. Other idea would be to make a class for farmhouse/stair... directly subclassing StaticMeshActor and checking for the class of the actor your trace hits. Thinking over it makes me draw the conclusion that this way is the better one. I've used it before...;)