1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

How do i get a meshes details!!! HELP

Discussion in 'Programming' started by widroy, Oct 31, 2005.

  1. widroy

    widroy New Member

    Joined:
    Oct 31, 2005
    Messages:
    2
    Likes Received:
    0
    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.

    Code:
    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!!!
     
  2. Hazard.ep

    Hazard.ep New Member

    Joined:
    Oct 7, 2003
    Messages:
    166
    Likes Received:
    0
    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...;)
     

Share This Page