[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):

UT3 Default Male with "Big Head"

Then Export it (FBX (2012)):

FBX Export. You can also export in *.PSK format if you are using 3dsmax 2011 or earlier

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:

Make sure you set "Origin --> Z = -51.00"

Now open Kismet and add the “Key/Button Pressed” Node:

New Event --> Input --> Key/Button Pressed

Then change the settings:

Make sure you set "Allowed Player Index" to 0. I set the Input key to "B"

Add a new “Switch” Node:

Make sure "Looping" is turned on and set the Link Count to 2.

Add two of our custom made Kismet Node “Change Player Mesh”:

New Action --> Change Player Mesh --> ChangePlayerMesh

Then set the Mesh , Animtree and Animsets like in the below picture:

"Bighead" is the new Mesh and "Normal Head" is the old default Mesh.

Now jump into game and TADA!!!

Press B:

Press B again:

Advertisements

About Satheesh (aka ryanjon2040)

Genuine Unreal Engine user

Posted on April 10, 2012, in Tutorials and tagged , , , , , , . Bookmark the permalink. 16 Comments.

  1. 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? :/

    Like

  2. 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

    Like

  3. yeah it works. thanks.

    Like

  4. 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?

    Like

  5. i can’t change the player, only the obj comment in screen when i press the button.

    can u help me? -.-a

    Like

  6. i did.

    can u give me your email, then i sent the screenshot

    Like

    • 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.

      Like

  7. This is a great tutorial…but…alas UDK has removed the Change Player Mesh action in Kismet!!!!

    Like

  8. Otimo tutorial..
    Mais pra mim deu certo !!
    Mais eu preciso para meu player que é UND e não UT..
    Pode me ajudar ?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: