Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

[SOLVED] Melee Shield - Attaching Actor to a Socket

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

  • [SOLVED] Melee Shield - Attaching Actor to a Socket

    I am currently attempting to attach a Skeletal Mesh Actor to a pawn, so he can use the mesh as a melee shield.

    My shield class is super simple, and looks like this:

    Code:
    class AegisShield extends Actor;
    
    var SkeletalMeshComponent ShieldMesh;
    
    
    DefaultProperties
    {
    	bHardAttach=true
    	
    	Begin Object Class=SkeletalMeshComponent Name=ShieldComponent
    		SkeletalMesh=SkeletalMesh'soldiercontent.Weapons.aegis'
    	End Object
    	ShieldMesh=ShieldComponent
    	Components.Add(ShieldComponent)
    }
    And then I attempt to attach the shield to a socket in my pawn's PostBeginPlay() function. As my pawn class is nearly 500 lines, I've cut out all the irrelevant functions here.


    Code:
    class AegisPawn extends UTPawn;
    
    
    // shield variable
    var archetype AegisShield ShieldArchetype;
    
    
    // PostBeginPlay
    simulated event PostBeginPlay()
    {		
    	local Vector SocketLocation;
    	local Rotator SocketRotation;
    	local AegisShield shield;
    	
    	super.PostBeginPlay();
    	AddInventoryItems();
    	`Log("Fomor Soldier has been spawned with Inventory"); //debug
    	
    	
    	if (Mesh != None)
    	{
    		if (ShieldArchetype != None && Mesh.GetSocketByName('ShieldSocket') != None)
    		{
    			Mesh.GetSocketWorldLocationAndRotation('ShieldSocket', SocketLocation, SocketRotation);
    			
    			shield = Spawn(ShieldArchetype.class,,, SocketLocation, SocketRotation, ShieldArchetype);
    			
    			if (shield != None)
    			{
    				shield.SetBase(Self,, Mesh, 'ShieldSocket');
    			}
    		}
    	}
    	
    }
    
    
    defaultproperties
    {
            // Shield attachment properties
    	ShieldArchetype=AegisShield'Soldier_Inventory.testShield'
    	bCanBeBaseForPawns=True 
    }
    I've tried a ton of variations on the code, and while the code compiles with no errors, I simply cannot get the shield to even appear. My logs show this warning:

    Code:
    ScriptLog: Fomor Sholdier has been spawned with Inventory
    Warning: GetSocketByName(): No SkeletalMesh for SkeletalMeshComponent_1
    Any ideas would be greatly appreciated!

  • #2
    Your posted code doesn't show a SkeletalMeshComponent for your AegisPawn in the default properties. Does AegisPawn have a SkeletalMeshComponent? From here, judging by the log you posted, it looks like it can't find a skeletal mesh because there isn't one.

    Comment


    • #3
      It does have a SkeletalMeshComponent object, I had just omitted it from the original post for the sake of simplicity. The complete defaultproperties section is pasted below:

      Code:
      defaultproperties
      {
      	// camera properties
      	CamHeight = 70.0
      	CamMinDistance = 40.0
      	CamMaxDistance = 350.0
         	CamOffsetDistance=250.0
      	CamZoomTick=20.0
      	
      	// Shield attachment properties
      	ShieldArchetype=AegisShield'Soldier_Inventory.testShield'
      	bCanBeBaseForPawns=True 
      	
      	//set light environment for player pawn
      	Begin Object Class=DynamicLightEnvironmentComponent Name=AegisLightEnvironment
      		bSynthesizeSHLight=TRUE
      		bIsCharacterLightEnvironment=TRUE
      		bUseBooleanEnvironmentShadowing=FALSE
      		InvisibleUpdateTime=1
      		MinTimeBetweenFullUpdates=.2
      	End Object
      	Components.Add(AegisLightEnvironment)
      		
      	
      	// begin player pawn configuration
      	Begin Object Class=SkeletalMeshComponent Name=AegisPawnComponent
          		SkeletalMesh=SkeletalMesh'Soldier_Pawn.Soldier_CAT_Run'
          		PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
          		bCacheAnimSequenceNodes=FALSE
          		AlwaysLoadOnClient=true
          		AlwaysLoadOnServer=true
          		bOwnerNoSee=false
          		CastShadow=true
          		BlockRigidBody=TRUE
          		bUpdateSkelWhenNotRendered=false
          		bIgnoreControllersWhenNotRendered=TRUE
          		bUpdateKinematicBonesFromAnimation=true
          		LightEnvironment=AegisLightEnvironment
          		bCastDynamicShadow=true
          		RBChannel=RBCC_Untitled3
          		RBCollideWithChannels=(Untitled3=true)
          		bOverrideAttachmentOwnerVisibility=true
          		bAcceptsDynamicDecals=FALSE
              	AnimTreeTemplate=AnimTree'Soldier_Pawn.Aegis_AnimTree'
              	bHasPhysicsAssetInstance=true
              	TickGroup=TG_PreAsyncWork
              	MinDistFactorForKinematicUpdate=0.2
              	bChartDistanceFactor=true
              	bSkipAllUpdateWhenPhysicsAsleep=TRUE
              	RBDominanceGroup=20
              	Scale=1.3975
              	bAllowAmbientOcclusion=false
              End Object  
      	
      	//  collision cylinder config
      	Begin Object Name=CollisionCylinder
      		CollisionRadius=+010.000000
      		CollisionHeight=+038.000000
      	End Object
      	CylinderComponent=CollisionCylinder
      	
      }
      I even tried adding "Components.Add(AegisPawnComponent)" to the properties, but all that did was spawn a second, non-animated pawn on top of my first one. Sadly enough, that pawn seems attached to my animated one lol if only it were a shield!

      Comment


      • #4
        Oh snap, I got it. Kinda feel like a dumbass now.

        I needed to add the following lines to the default properties of my pawn.

        Code:
        Mesh=AegisPawnComponent
        Components.Add(AegisPawnComponent)
        Thanks for the help buddy

        Comment


        • #5
          No prob

          Comment

          Working...
          X