So, first thing, only owner see - this is a native code driven by default properties of an Actor class
Code: Select all
// Advanced.
var(Advanced) bool bOwnerNoSee; // Everybody but the owner can see this actor.
var(Advanced) bool bOnlyOwnerSee; // Only owner can see this actor.
Then, there is this Inventory class where you have the ThirdPersonMesh (driven entirely by native code, can't do much about it), pickup mesh, which just changes the Display mesh when an item becomes a pickup.
Code: Select all
// Pickup view rendering info.
var() mesh PickupViewMesh; // Mesh to render.
var() float PickupViewScale; // Mesh scale.
//
// Become a pickup.
//
function BecomePickup()
{
if ( Physics != PHYS_Falling )
RemoteRole = ROLE_SimulatedProxy;
Mesh = PickupViewMesh;
DrawScale = PickupViewScale;
bOnlyOwnerSee = false;
bHidden = false;
bCarriedItem = false;
NetPriority = 2;
SetCollision( true, false, false );
}
And then there is this Player View Mesh which you are interested in.
Code: Select all
// Player view rendering info.
var() vector PlayerViewOffset; // Offset from view center.
var() mesh PlayerViewMesh; // Mesh to render.
var() float PlayerViewScale; // Mesh scale.
var() float BobDamping; // how much to damp view bob
//
// Become an inventory item.
//
function BecomeItem()
{
RemoteRole = ROLE_DumbProxy;
Mesh = PlayerViewMesh;
DrawScale = PlayerViewScale;
bOnlyOwnerSee = true;
bHidden = true;
bCarriedItem = true;
NetPriority = 2;
SetCollision( false, false, false );
SetPhysics(PHYS_None);
SetTimer(0.0,False);
AmbientGlow = 0;
}
But this makes the item totally hidden, this is an inventory item, no mesh viewing from the viewport. Inventory items don't really have PlayerViewMesh. As it comes to drawing the weapon mesh I haven't found any code in UScript. So - probably native. BUT! There is this Enforcer from UT. It draws 2 meshes. Why won't we look there? (I'm typing and looking at the same time, so, yea, kind of adventure really
)
Code: Select all
function bool HandlePickupQuery( inventory Item )
{
local Pawn P;
local Inventory Copy;
if ( (Item.class == class) && (SlaveEnforcer == None) )
{
P = Pawn(Owner);
// spawn a double
Copy = Spawn(class, P);
Copy.BecomeItem();
ItemName = DoubleName;
SlaveEnforcer = Enforcer(Copy);
SetTwoHands();
AIRating = 0.4;
SlaveEnforcer.SetUpSlave( Pawn(Owner).Weapon == self );
SlaveEnforcer.SetDisplayProperties(Style, Texture, bUnlit, bMeshEnviromap);
SetTwoHands();
P.ReceiveLocalizedMessage( class'PickupMessagePlus', 0, None, None, Self.Class );
Item.PlaySound(Item.PickupSound);
if (Level.Game.LocalLog != None)
Level.Game.LocalLog.LogPickup(Item, Pawn(Owner));
if (Level.Game.WorldLog != None)
Level.Game.WorldLog.LogPickup(Item, Pawn(Owner));
Item.SetRespawn();
return true;
}
return Super.HandlePickupQuery(Item);
}
function SetUpSlave(bool bBringUp)
{
bIsSlave = true;
ItemName = DoubleName;
GiveAmmo(Pawn(Owner));
AmbientGlow = 0;
if ( bBringUp )
BringUp();
else
GotoState('Idle2');
}
Well, it seems that UT "copies" the Enforcer, and player is actually holding 2 guns, one is driven by the other enforcer. Well, that sucks really. But, don't be afraid, there is something...
So, after 5 minutes search I've found that these two:
Code: Select all
simulated function PreRender( canvas Canvas );
simulated function PostRender( canvas Canvas );
in Weapon class render the weapon and the crosshair. They are called UnrealHUD
Code: Select all
simulated function PreRender( canvas Canvas )
{
if (PlayerPawn(Owner).Weapon != None)
PlayerPawn(Owner).Weapon.PreRender(Canvas);
}
But there is a function in Canvas for rendering meshes. I just don't really remember it.
The Pawn however is calling the overlay render for muzzle flashes.
Code: Select all
simulated event RenderOverlays( canvas Canvas )
{
local rotator NewRot;
local bool bPlayerOwner;
local int Hand;
local PlayerPawn PlayerOwner;
if ( bHideWeapon || (Owner == None) )
return;
PlayerOwner = PlayerPawn(Owner);
if ( PlayerOwner != None )
{
bPlayerOwner = true;
Hand = PlayerOwner.Handedness;
}
if ( (Level.NetMode == NM_Client) && bPlayerOwner && (Hand == 2) )
{
bHideWeapon = true;
return;
}
if ( !bPlayerOwner || (PlayerOwner.Player == None) )
Pawn(Owner).WalkBob = vect(0,0,0);
if ( (bMuzzleFlash > 0) && bDrawMuzzleFlash && Level.bHighDetailMode && (MFTexture != None) )
{
MuzzleScale = Default.MuzzleScale * Canvas.ClipX/640.0;
if ( !bSetFlashTime )
{
bSetFlashTime = true;
FlashTime = Level.TimeSeconds + FlashLength;
}
else if ( FlashTime < Level.TimeSeconds )
bMuzzleFlash = 0;
if ( bMuzzleFlash > 0 )
{
if ( Hand == 0 )
Canvas.SetPos(Canvas.ClipX/2 - MuzzleScale * FlashS + Canvas.ClipX * (-0.2 * Default.FireOffset.Y * FlashO), Canvas.ClipY/2 - MuzzleScale * FlashS + Canvas.ClipY * (FlashY + FlashC));
else
Canvas.SetPos(Canvas.ClipX/2 - MuzzleScale * FlashS + Canvas.ClipX * (Hand * Default.FireOffset.Y * FlashO), Canvas.ClipY/2 - MuzzleScale * FlashS + Canvas.ClipY * FlashY);
Canvas.Style = 3;
Canvas.DrawIcon(MFTexture, MuzzleScale);
Canvas.Style = 1;
}
}
else
bSetFlashTime = false;
SetLocation( Owner.Location + CalcDrawOffset() );
NewRot = Pawn(Owner).ViewRotation;
if ( Hand == 0 )
newRot.Roll = -2 * Default.Rotation.Roll;
else
newRot.Roll = Default.Rotation.Roll * Hand;
setRotation(newRot);
Canvas.DrawActor(self, false);
}
No playermesh anywhere I can see... Hope I helped a bit at least.
Big post, sorry for that.
Edith:
Found it -
https://wiki.beyondunreal.com/Legacy:Canvas_(UT)
You probably can render meshes/actors on screen.
Code: Select all
DrawActor (Actor (UT) A, bool WireFrame, optional bool ClearZ)
Draws the actor A at its current location, whether it's actually visible or not. The actor can be drawn as wire frame or how it actually looks. ClearZ causes the actor to be drawn on top of everything else, i.e. it will be visible even if it would normally be (partially or completely) obscured by other objects.
So, the weapon might be bHidden but still rendered. It's a blind guess here.