Announcement

Collapse
No announcement yet.

Controlling bones

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

    Controlling bones

    Hey,


    So i tried this code:

    Code:
    class SkelControlLimbPawn extends Pawn
      Placeable;
    
    var(SkelControl) Name LeftArmSkelControlName;
    var(SkelControl) Name RightArmSkelControlName;
    var(SkelControl) Actor LeftArmAttachment;
    var(SkelControl) Actor RightArmAttachment;
    
    var SkelControlLimb LeftArmSkelControl;
    var SkelControlLimb RightArmSkelControl;
    
    simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
    {
      Super.PostInitAnimTree(SkelComp);
    
      if (SkelComp == Mesh)
      {
        LeftArmSkelControl = SkelControlLimb(Mesh.FindSkelControl(LeftArmSkelControlName));
        RightArmSkelControl = SkelControlLimb(Mesh.FindSkelControl(RightArmSkelControlName));
      }
    }
    
    simulated event Destroyed()
    {
      Super.Destroyed();
    
      LeftArmSkelControl = None;
      RightArmSkelControl = None;
    }
    
    simulated event Tick(float DeltaTime)
    {
      Super.Tick(DeltaTime);
    
      if (LeftArmSkelControl != None && LeftArmAttachment != None)
      {
        LeftArmSkelControl.EffectorLocation = LeftArmAttachment.Location;
      }
    
      if (RightArmSkelControl != None && RightArmAttachment != None)
      {
        RightArmSkelControl.EffectorLocation = RightArmAttachment.Location;
      }
    }
    
    defaultproperties
    {
      Begin Object Class=SkeletalMeshComponent Name=PawnMesh
      End Object
      Mesh=PawnMesh
      Components.Add(PawnMesh)
    
      Physics=PHYS_Falling
    
      Begin Object Name=CollisionCylinder
        CollisionRadius=+0030.0000
        CollisionHeight=+0072.000000
      End Object
    }
    But I keep getting acces none when i try to move it at the tick event. I know I have to fill in the bones in the editor for leftarmSkelControl and right but i got a feeling i did something wrong but i dont know what. And is it possible to set a speed for the bones to move? So slow or fast movement.

    #2
    You did not specify Left- and RightArmSkelControlName in defaultproperties. You need to assign strings containing the names of actual skelcontrols you defined in your AnimTree.

    Comment


      #3
      Doesnt work, I still keep getting accesed none. I tried
      Code:
      LeftArmSkelControlName = 'LeftHandIK'
      and
      Code:
      LeftArmSkelControlName = "LeftHandIK"
      I am using the human animtree or did copy the wrong name. I just searched for the name in the properties of the skelcontrol in the anim tree I did ofc the same for the righthand.

      Comment


        #4
        Ok i fixed it i just changed LeftArmSkelControl = SkelControlLimb(Mesh.FindSkelControl(LeftArmSkelCo ntrolName)); to LeftArmSkelControl = SkelControlLimb(Mesh.FindSkelControl('LeftHandIK') );

        Comment

        Working...
        X