Page 1 of 1

Rendering Objects On Canvas

PostPosted: Sun Nov 25, 12 2:30 am
by SimonDenton
Hey all. I am trying to simply have a mesh object displayed on the screen like how 1st person weapons work but within a HUD window. I have a bad or missing expression when trying to spawn the mesh:

Code: Select all
class TestMesh extends AlarmUnit;

var Canvas canvas;
var SummerPlayer PlayerOwner;
var Inventory inventory;

function GoOnScreen()
{

local rotator NewRot;


PlayerOwner = SummerPlayer(GetPlayerPawn());
   Self.SetLocation( PlayerOwner.Location + CalcDrawOffset());
   NewRot = PlayerOwner.ViewRotation;

   Self.setRotation(newRot);
   Canvas.DrawActor(Self, false);
      
}

simulated function vector CalcDrawOffset()
{
local vector DrawOffset, WeaponBob;
DrawOffset = ((0.9/PlayerOwner.FOVAngle * inventory.PlayerViewOffset) >> PlayerOwner.ViewRotation);
DrawOffset += (PlayerOwner.EyeHeight * vect(0,0,1));
      
return DrawOffset;
}
      
   defaultProperties
   {
   ItemName="Testing Mesh"
   }


The window spawns this object and calls the PutOnScreen function but the object spawns in the world and not on the canvas.

Please help. Thanks.

PostPosted: Sun Nov 25, 12 3:58 am
by Poor
It should be Spawn(class'AlarmUnit') not Spawn(class<AlarmUnit>).

PostPosted: Sun Nov 25, 12 4:56 am
by SimonDenton
Thanks Poor! Updated the code. The alarm unit spawns but not on the canvas :/

PostPosted: Mon Nov 26, 12 2:29 am
by Poor
You declared a Canvas variable but you didn't assign anything to it. It will be null and you'll get access nones. I don't see what is calling GoOnScreen() either.

It looks like you are trying to have an alarm unit on the players screen. A texture would work better than an actor. But if you are trying actors then you should set all the collision and blocking variables to false so it can move freely.

I believe you have to use a Window to properly use DrawActor. AugmentationDisplayWindow shows how DrawActor is used for the vision aug.

PostPosted: Mon Dec 03, 12 11:11 am
by SimonDenton
Initially I tried textures but rotating GUI in UE1 is impossible. So I thought "How about rendering a rotating actor?". Thanks for the help. I was trying to use the same method weapons use to render animated/moving actors on the screen so I can have rotating UI at some point.