Announcement

Collapse
No announcement yet.

[Solved] Modular Pawn in combination with Archetype Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Solved] Modular Pawn in combination with Archetype Problem

    Hey Guys,

    this once worked and I don't know whats wrong now. What I try to do is the following. I want to replace the default Mesh with doing this:

    Code:
    Components.Remove(WPawnSkeletalMeshComponent)
    and replace it with my custom char mesh:

    Code:
    Mesh=NakedBodyComponent
    NakedBody=NakedBodyComponent
    Components.Add(NakedBodyComponent)
    If I set Mesh="AnyMeshComponent" it will load the default Mesh (the udk robot). Despite whats set within the script or in the archetype. Why??

    If I don't set:

    Code:
    Mesh="AnyMeshComponent"
    It works but of cause the inventory/weapon system no longer works since mesh is no longer set. Anyone got an idea what I could have done wrong? Here is the complete code of my Pawn:

    Code:
    class ArenaPawn extends UTPawn;
    
    
    //CUSTOM CHARACTER VARS
    // Skeletal mesh which represents the Body
    var(ArenaPawn) const SkeletalMeshComponent NakedBody;
    // Skeletal mesh which represents the Hair of the BodyMesh
    var(ArenaPawn) const SkeletalMeshComponent ClothHair;
    
    defaultproperties
    {
    	//CUSTOMIZATION PART BEGIN
    	
    	// Remove UTPawn's defined skeletal mesh
    	Components.Remove(WPawnSkeletalMeshComponent)
    	
    	Begin Object Class=SkeletalMeshComponent Name=NakedBodyComponent
    		SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
    		AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
    		AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
    		PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
    		
    		
    		bCacheAnimSequenceNodes=false
    		AlwaysLoadOnClient=true
    		AlwaysLoadOnServer=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
    	End Object
    	Mesh=NakedBodyComponent
    	NakedBody=NakedBodyComponent
    	Components.Add(NakedBodyComponent)
    
    	Begin Object Class=SkeletalMeshComponent Name=ClothHairComponent      
    		bCacheAnimSequenceNodes=false
    		AlwaysLoadOnClient=true
    		AlwaysLoadOnServer=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=NakedBodyComponent
                    // 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=NakedBodyComponent
    	End Object
    	ClothHair=ClothHairComponent
    	Components.Add(ClothHairComponent)
    	
    }
    Thanks for anyhelp!

    #2
    Anyone? I really could use some help with this. Thanks for any reply!

    Comment


      #3
      because it extends UTPawn its getting the mesh info from its family info
      either create your own family info class or override this function in your pawn like this
      Code:
      simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info);
      also overide the mesh in default properties
      Code:
      Begin Object Name=WPawnSkeletalMeshComponent
      		AnimTreeTemplate=AnimTreeyour_Anim_Tree'
      		SkeletalMesh=SkeletalMesh'yourMesh'
      		AnimSets(0)=AnimSet'yourAnims'
      		PhysicsAsset=PhysicsAsset'yourPhysics'
      	End Object

      Comment


        #4
        Originally posted by tegleg View Post
        because it extends UTPawn its getting the mesh info from its family info
        either create your own family info class or override this function in your pawn like this
        Code:
        simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info);
        Thank you very much! That did the trick .

        Comment


          #5
          just edited and added a bit more

          Comment


            #6
            Originally posted by tegleg View Post
            just edited and added a bit more
            Thank you very much. I think my final solution is even a bit more elegant now. Here is what I have done:

            If you do it this way you don't need to set WPawnSkeletalMeshComponent. You just remove it and assign another Mesh in default properties.

            Code:
            class ArenaPawn extends UTPawn;
            
            //CUSTOM CHARACTER VAR
            // Skeletal mesh which represents the Body. Parent skeletal mesh component.
            var(ArenaPawn) const SkeletalMeshComponent ClothPant;
            
            
            simulated function PostBeginPlay(){
            	ClothPant.SetParentAnimComponent(Mesh);
            	super.PostBeginPlay();
            }
            
            simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info);
            
            defaultproperties
            {
            	//CUSTOMIZATION PART BEGIN
            	
            	// Remove UTPawn's defined skeletal mesh
            	Components.Remove(WPawnSkeletalMeshComponent)
            	
            	Begin Object Class=SkeletalMeshComponent Name=NakedBodyComponent
            		bCacheAnimSequenceNodes=false
            		AlwaysLoadOnClient=true
            		AlwaysLoadOnServer=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
            	End Object
            	Mesh=NakedBodyComponent
            	Components.Add(NakedBodyComponent)
            
            	Begin Object Class=SkeletalMeshComponent Name=ClothPantComponent      
            		bCacheAnimSequenceNodes=false
            		AlwaysLoadOnClient=true
            		AlwaysLoadOnServer=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
            		ShadowParent=NakedBodyComponent
            	End Object
            	ClothPant=ClothPantComponent
            	Components.Add(ClothPantComponent)
            	
            }
            And you need to add this code to your GameInfo class:

            Code:
            class ArenaGame extends UTGame;
            
            var() archetype ArenaPawn PawnArchetype;
            
            function Pawn SpawnDefaultPawnFor(Controller NewPlayer, NavigationPoint StartSpot)
            {
                local Pawn SpawnedPawn;
            
                if (NewPlayer == none || StartSpot == none)
                {
                    return none;
                }
            
                SpawnedPawn = Spawn(PawnArchetype.Class,,, StartSpot.Location,, PawnArchetype);
            
                return SpawnedPawn;
            }
            
            defaultproperties
            {
            	PawnArchetype=ArenaPawn'test_char.Archetypes.ArenaPawn' // <-PawnArchetype=<full name of archetype>
            }
            This way you can edit all your mesh, animtree, animseq etc info in the unreal editor. You just have to create an archetype of your pawn. And copy the full name of this archetype

            Comment

            Working...
            X