PDA

View Full Version : LinkMesh problem



jsterj
01-22-2007, 10:58 PM
I am having a minor problem with the LinkMesh function. I have searched everywhere for answers and poured through countless lines of code. So now I will ask the infinite intelligence that is the Unreal community for assistance.

Here's the deal. I want a player, at some point, to dynamically change his mesh. I set up an exec function, to call a function in my Pawn, that loads the new mesh and then calls LinkMesh. The new mesh shows up properly on my Pawn and works fine. However.... After that happens, a small birdhead is left behind floating in the air.

(If your not sure what I mean by birdhead, open UnrealEd, go to the texture browser, drop down to the Engine package, and look for the S_Actor texture.)

After much trial and error, my only guess is that the birdhead is the left over mesh from before I made the change. (e.g. if I am playing as Jakob, and use LinkMesh to change me to Brock, what happens to the instance of Jakob's Mesh.) Since meshes are not actors, I can't simply try to destroy it, if that's even what is being left behind.

I've looked through the existing UT2004 code and tried determining how they destroy meshes when a player dies, or when how they change a player to a skeleton (e.g. Lava Death), and can't see what they are doing different than me. I'll post some code below from my Pawn Class.



class MyPawn extends XPawn;

function ChangeMyMesh();
{
local mesh MyMesh;

MyMesh = Mesh(DynamicLoadObject(MyClass.default.MeshName, class'Mesh'));
LinkMesh(MyMesh);
AssignInitialPose();
}

Hsoolien
01-22-2007, 11:38 PM
Somwhow you spaned an actor with bVisible set true drawtype set to DT_Sprite and a default skin slot..., or some combo there of.

jsterj
01-23-2007, 08:29 AM
Well, you were right. I have another class that spawns and is associated with the pawn, that was never set to bHidden = True. I had become fixated on thinking the problem was caused by the new mesh, and overlooked something very simple. Thanks for the wake up!

Hsoolien
01-23-2007, 10:07 AM
It happens to all of us at one time or another