Hello everyone,
I've successfully created a custom modular pawn and made it the player character. It's working fine, the animations from my custom animtree are working as expected, yet I'm unable to change the modular pawn's skeletal mesh components during the game.
I've searched everywhere, but so far no solution works.
My custom Player Controller class is this:
(Note: the exec functions are binded to the keys "I" and "O". These functions seem to be called, as they appear in the log files. And yes, there is a package called MyPackage with modulopernasM and modulotroncoM meshes there.)
My custom Pawn class is this:
(Note:I've already tried turning those three skeletal meshes vars into non-constants, but the issue remains. By the way, I also tried making custom functions inside this custom pawn class to change the meshes and then have the custom playercontroller class call those functions instead of directly setting the skeletalmeshes, however nothing happened.)
Does anyone has any ideias on why I'm unable to change the modular pawn's skeletalmeshes during the game? Is there anything wrong with my code or did I forgot to do something?
I've successfully created a custom modular pawn and made it the player character. It's working fine, the animations from my custom animtree are working as expected, yet I'm unable to change the modular pawn's skeletal mesh components during the game.
I've searched everywhere, but so far no solution works.
My custom Player Controller class is this:
Code:
class JTPlayerController extends UTPlayerController
config(JTGame);
exec function MudarModuloTorso()
{
JTPawn(Pawn).TorsoSkeletalMesh.SetSkeletalMesh(SkeletalMesh'MyPackage.modulotroncoM');
}
exec function MudarModuloPernas()
{
JTPawn(Pawn).LegsSkeletalMesh.SetSkeletalMesh(SkeletalMesh'MyPackage.modulopernasM');
}
defaultproperties
{
bBehindView=true;
bForceBehindView=true;
}
(Note: the exec functions are binded to the keys "I" and "O". These functions seem to be called, as they appear in the log files. And yes, there is a package called MyPackage with modulopernasM and modulotroncoM meshes there.)
My custom Pawn class is this:
Code:
class JTPawn extends UTPawn placeable;
// Skeletal mesh which represents the head. Parent skeletal mesh component.
var(PersonaModular) const SkeletalMeshComponent HeadSkeletalMesh;
// Skeletal mesh which represents the upper body. Child to the head skeletal mesh component.
var(PersonaModular) const SkeletalMeshComponent TorsoSkeletalMesh;
// Skeletal mesh which represents the lower body. Child to the head skeletal mesh component.
var(PersonaModular) const SkeletalMeshComponent LegsSkeletalMesh;
defaultproperties
{
Begin Object Name=MyLightEnvironment
bSynthesizeSHLight=TRUE
bIsCharacterLightEnvironment=TRUE
End Object
Components.Add(MyLightEnvironment)
LightEnvironment=MyLightEnvironment
// Remove UTPawn's defined skeletal mesh
Components.Remove(WPawnSkeletalMeshComponent)
// Create the head skeletal mesh component
Begin Object Class=SkeletalMeshComponent Name=HeadSkeletalMeshComponent
SkeletalMesh=SkeletalMesh'MyPackage.modulocabeca';
AnimTreeTemplate=AnimTree'MyPackage.funcoesani1';
AnimSets(0)=AnimSet'MyPackage.anitestes1';
LightEnvironment=MyLightEnvironment;
bCacheAnimSequenceNodes=false
AlwaysLoadOnClient=true
AlwaysLoadOnServer=true
bOwnerNoSee=true
CastShadow=true
BlockRigidBody=true
bUpdateSkelWhenNotRendered=false
bIgnoreControllersWhenNotRendered=true
bUpdateKinematicBonesFromAnimation=true
bCastDynamicShadow=true
RBChannel=RBCC_Untitled3
RBCollideWithChannels=(Untitled3=true)
bOverrideAttachmentOwnerVisibility=true
bAcceptsDynamicDecals=false
bHasPhysicsAssetInstance=true
TickGroup=TG_PreAsyncWork
MinDistFactorForKinematicUpdate=0.2
bChartDistanceFactor=true
RBDominanceGroup=20
bUseOnePassLightingOnTranslucency=true
bPerBoneMotionBlur=true
End Object
HeadSkeletalMesh=HeadSkeletalMeshComponent
Components.Add(HeadSkeletalMeshComponent)
Mesh=HeadSkeletalMeshComponent
// Create the upper body skeletal mesh component
Begin Object Class=SkeletalMeshComponent Name=TorsoSkeletalMeshComponent
SkeletalMesh=SkeletalMesh'MyPackage.modulotronco'
bCacheAnimSequenceNodes=false
AlwaysLoadOnClient=true
AlwaysLoadOnServer=true
bOwnerNoSee=true
CastShadow=true
BlockRigidBody=true
bUpdateSkelWhenNotRendered=false
bIgnoreControllersWhenNotRendered=true
bUpdateKinematicBonesFromAnimation=true
bCastDynamicShadow=true
RBChannel=RBCC_Untitled3
RBCollideWithChannels=(Untitled3=true)
LightEnvironment=MyLightEnvironment
bOverrideAttachmentOwnerVisibility=true
bAcceptsDynamicDecals=false
bHasPhysicsAssetInstance=true
TickGroup=TG_PreAsyncWork
MinDistFactorForKinematicUpdate=0.2
bChartDistanceFactor=true
RBDominanceGroup=20
bUseOnePassLightingOnTranslucency=true
bPerBoneMotionBlur=true
// Assign the parent animation component to the head skeletal mesh component. This ensures that
// the pawn animates as if it was one skeletal mesh component.
ParentAnimComponent=HeadSkeletalMeshComponent
// Assign the shadow parent component to the head skeletal mesh component. This is used to speed up
// the rendering of the shadow for this pawn and to prevent shadow overlaps from occur.
ShadowParent=HeadSkeletalMeshComponent
End Object
TorsoSkeletalMesh=TorsoSkeletalMeshComponent
Components.Add(TorsoSkeletalMeshComponent)
// Create the lower body skeletal mesh component
Begin Object Class=SkeletalMeshComponent Name=LegsSkeletalMeshComponent
SkeletalMesh=SkeletalMesh'MyPackage.modulopernas'
bCacheAnimSequenceNodes=false
AlwaysLoadOnClient=true
AlwaysLoadOnServer=true
bOwnerNoSee=true
CastShadow=true
BlockRigidBody=true
bUpdateSkelWhenNotRendered=false
bIgnoreControllersWhenNotRendered=true
bUpdateKinematicBonesFromAnimation=true
bCastDynamicShadow=true
RBChannel=RBCC_Untitled3
RBCollideWithChannels=(Untitled3=true)
LightEnvironment=MyLightEnvironment
bOverrideAttachmentOwnerVisibility=true
bAcceptsDynamicDecals=false
bHasPhysicsAssetInstance=true
TickGroup=TG_PreAsyncWork
MinDistFactorForKinematicUpdate=0.2
bChartDistanceFactor=true
RBDominanceGroup=20
bUseOnePassLightingOnTranslucency=true
bPerBoneMotionBlur=true
// Assign the parent animation component to the head skeletal mesh component. This ensures that
// the pawn animates as if it was one skeletal mesh component.
ParentAnimComponent=HeadSkeletalMeshComponent
// Assign the shadow parent component to the head skeletal mesh component. This is used to speed up
// the rendering of the shadow for this pawn and to prevent shadow overlaps from occur.
ShadowParent=HeadSkeletalMeshComponent
End Object
LegsSkeletalMesh=LegsSkeletalMeshComponent
Components.Add(LegsSkeletalMeshComponent)
}
(Note:I've already tried turning those three skeletal meshes vars into non-constants, but the issue remains. By the way, I also tried making custom functions inside this custom pawn class to change the meshes and then have the custom playercontroller class call those functions instead of directly setting the skeletalmeshes, however nothing happened.)
Does anyone has any ideias on why I'm unable to change the modular pawn's skeletalmeshes during the game? Is there anything wrong with my code or did I forgot to do something?