[Tutorial] Change Player Mesh via Kismet
Hello everyone…In this tutorial you will learn to change Player Mesh by pressing any button in-game. We achieve this by using a custom Kismet Node.
Click on the pictures to see large image.
First create the mesh. I used the default IronGuard mesh downloaded from here (3dsmax file):
Then Export it (FBX (2012)):
Then copy/paste this UnrealScript code and compile.
/**NOTE: I am NOT the creator of this script. I got this when i was searching google for a solution to change player mesh via kismet since “Set Mesh” was not working.**/
class SeqAct_ChangePlayerMesh extends SequenceAction; var() SkeletalMesh newMesh; var MaterialInterface defaultMaterial0; var() AnimTree newAnimTree; var() array<AnimSet> newAnimSet; var() PhysicsAsset newPhysicsAsset; event Activated() { local int i; local UTPlayerController PC; PC = UTPlayerController(GetWorldInfo().GetALocalPlayerController()); PC.Pawn.Mesh.SetSkeletalMesh(newMesh); PC.Pawn.Mesh.SetPhysicsAsset(newPhysicsAsset); PC.Pawn.Mesh.AnimSets=newAnimSet; PC.Pawn.Mesh.SetAnimTreeTemplate(newAnimTree); for (i = 0; i < PC.Pawn.Mesh.SkeletalMesh.Materials.length; i++) { PC.Pawn.Mesh.SetMaterial( i, defaultMaterial0 ); } } defaultproperties { ObjName="ChangePlayerMesh" ObjCategory="Change Player Mesh" VariableLinks.empty; }
Screenshot:
Then import the FBX Skeletal Mesh into UDK:
Now open Kismet and add the “Key/Button Pressed” Node:
Then change the settings:
Add a new “Switch” Node:
Add two of our custom made Kismet Node “Change Player Mesh”:
Then set the Mesh , Animtree and Animsets like in the below picture:
Now jump into game and TADA!!!
Press B:
Press B again:
Posted on April 10, 2012, in Tutorials and tagged change player mesh, kismet, pawn mesh, player, udn, Unreal X-Editor, UnrealScript. Bookmark the permalink. 16 Comments.
For some reason, the script doesn’t compile for me.
It says: Unrecognized type ‘UTPlayerController PC’
My script is in Development\Src\Engine\Classes
any help?
LikeLike
Thats because you saved to Engine/Classes folder. Move it to MyMod/Classes and compile.
NOTE: Make sure you have ModEditPackages=MyMod in section [UnrealEd.EditorEngine] in DefaultEngineUDK.ini
LikeLike
yeah it works. thanks.
LikeLike
i wanna ask, why the player doesn’t change? when i press the button, only the object command in the screen but why the player doesn’t change?
LikeLike
i can’t change the player, only the obj comment in screen when i press the button.
can u help me? -.-a
LikeLike
Did you applied AnimTree, Animset and Skeletal Mesh? If you can please post a screenshot of your kismet setup.
LikeLike
i did.
can u give me your email, then i sent the screenshot
LikeLike
ok i’ll mail you.
LikeLike
LikeLike
Oh ok now i get it. Do this: On the top Menubar click on View —> World Properties. And in world properties click on Game Type and set Default Game Type and Game Type for PIE to UTGame. Then you will see the player mesh.
LikeLike
This is a great tutorial…but…alas UDK has removed the Change Player Mesh action in Kismet!!!!
LikeLike
Otimo tutorial..
Mais pra mim deu certo !!
Mais eu preciso para meu player que é UND e não UT..
Pode me ajudar ?
LikeLike
Otimo tutorial..
Mais pra mim deu certo !!
Mais eu preciso para meu player que é UND e não UT..
Pode me ajudar.. ?
LikeLike
Não precisa mais 🙂
É só mudar o “controle”
LikeLike
It would be great if you uh…speak in English 🙂
LikeLike
Thank you!
LikeLike