Working with Skeletal Mesh in Unreal Engine

Published on

What is it Skeletal Mesh, what properties does it have and how to work with it in the Unreal Engine?

Platforma

Skeletal meshes

Skeletal Meshes are made up of two parts: A set of polygons composed to make up the surface of the Skeletal Mesh, and a hierarchical set of interconnected bones which can be used to animate the vertices of the polygons.

Skeleton in Unreal Engine

They are often used to represent characters or other animating objects. The 3D models, rigging and animations are created in an external modeling and animation application (3DSMax, Maya, Softimage, etc), and are then imported into Unreal Engine and saved into packages by using Unreal Editor's Content Browser.

Import Skeletal Mesh

We work in an inherited class from UBlueprintFunctionLibrary, thus our header file should look like below:

<mark>#include "Kismet/BlueprintFunctionLibrary.h"</mark> // Engine
UCLASS()
class UExampleClass : public <mark>UBlueprintFunctionLibrary</mark>
{
 GENERATED_BODY()
public:
 /**
  * Editor Only - Will not work in packaged build.
  *
  * <mark>Create and process a SkeletalMesh import task.</mark>
  *
  * @param SourcePath   The path of the source file: "C:/Temp/MySkeletalMesh.fbx"
  * @param DestinationPath The path of the imported asset: "/Game/Folder/MySkeletalMesh"
  * @param bOutSuccess  If the action was a success or not
  * @param OutInfoMsg   More information about the action's result
  *
  * @return The imported SkeletalMesh
  */
 UFUNCTION(BlueprintCallable, Category = " ... ")
 <strong>static class USkeletalMesh* ImportSkeletalMesh(FString SourcePath, FString DestinationPath, bool& bOutSuccess, FString& OutInfoMsg);</strong>
};

Import animation for Skeletal Mesh

/**
 * Editor Only - Will not work in packaged build.
 *
 * <mark>Create and process a Animation import task.</mark>
 *
 * @param SourcePath The path of the source file: "C:/Temp/MyAnimation.fbx"
 * @param DestinationPath  The path of the imported asset: "/Game/Folder/MyAnimation"
 * @param SkeletonPath  The path of the the skeleton to use: "/Game/Folder/MySkeleton"
 * @param bOutSuccess   If the action was a success or not
 * @param OutInfoMsg More information about the action's result
 *
 * @return The imported Animation
 */
UFUNCTION(BlueprintCallable, Category = " ... ")
<strong>static class UAnimSequence* ImportAnimation(FString SourcePath, FString DestinationPath, FString SkeletonPath, bool& bOutSuccess, FString& OutInfoMsg);</strong>

Assign material for Skeletal Mesh

Vrealmatic consulting

Anything unclear?

Let us know!

Contact Us