AnyPortrait > Script > Bone

Bone


Functions that reference or control bones.
Contains functions that reference a socket or control it with IK.


public apOptBone GetBone ( string boneName )
public apOptBone GetBone ( int rootUnitIndex, string boneName )
Description

   Find the bone by name and return it.
   If you do not specify a root unit index, first perform a full search from the root unit that is currently being rendered.


Parameters

   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to reference


Return

   apOptBone : The bone retrieved. Return null if not


public Transform GetBoneSocket ( apOptBone optBone )
public Transform GetBoneSocket ( string boneName )
public Transform GetBoneSocket ( int rootUnitIndex, string boneName )
Description

   References socket of a bone.
   Please refer to related page about socket.


Parameters

   apOptBone optBone : Bone containing socket
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to reference


Return

   Transform : Socket Transform of bone. Return null if not


public bool SetBonePosition ( apOptBone optBone, Vector3 position,
                Space space, float weight = 1.0f )
public bool SetBonePosition ( string boneName, Vector3 position,
                Space space, float weight = 1.0f )
public bool SetBonePosition ( int rootUnitIndex, string boneName, Vector3 position,
                Space space, float weight = 1.0f )
Description

   Controls the position of the bone.
   You can interpolate using weights
   IK does not work.​


Parameters

   apOptBone optBone : Bone to control
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to control
   Vector3 position : Position to move
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with position of animated bone


Return

   bool : If it refers to a bone that does not exist, false is returned.


public bool SetBoneRotation ( apOptBone optBone, float angle,
                Space space, float weight = 1.0f )
public bool SetBoneRotation ( string boneName, float angle,
                Space space, float weight = 1.0f )
public bool SetBoneRotation ( int rootUnitIndex, string boneName, float angle,
                Space space, float weight = 1.0f )
Description

   Controls the rotation angle of the bone.
   You can interpolate using weights.


Parameters

   apOptBone optBone : Bone to control
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to control
   float angle : Angle to rotate (Degree)
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with rotation of animated bone


Return

   bool : If it refers to a bone that does not exist, false is returned.


public bool SetBoneScale ( apOptBone optBone, Vector3 scale,
                Space space, float weight = 1.0f )
public bool SetBoneScale ( string boneName, Vector3 scale,
                Space space, float weight = 1.0f )
public bool SetBoneScale ( int rootUnitIndex, string boneName, Vector3 scale,
                Space space, float weight = 1.0f )
Description

   Controls the size of the bone.
   You can interpolate using weights.


Parameters

   apOptBone optBone : Bone to control
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to control
   Vector3 scale : Scale value
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with scale of animated bone


Return

   bool : If it refers to a bone that does not exist, false is returned.


public bool SetBoneIK ( apOptBone optBone, Vector3 position,
                Space space, float weight = 1.0f, bool isContinuous = true )
public bool SetBoneIK ( string boneName, Vector3 position,
                Space space, float weight = 1.0f, bool isContinuous = true )
public bool SetBoneIK ( int rootUnitIndex, string boneName, Vector3 position,
                Space space, float weight = 1.0f, bool isContinuous = true )
Description

   Use IK to move the bone.
   Refer to the related page for how to set the IK of the bone.
   You can interpolate using weights.


Parameters

   apOptBone optBone : Bone to control
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to control
   Vector3 position : Position to move. Depending on the IK, the location may not be reached.
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with position of animated bone
   bool isContiuous : If true, the IK result of the previous frame is referenced to ensure a natural result.


Return

   bool : If it refers to a bone that does not exist, false is returned.


public bool SetBoneLookAt ( apOptBone optBone, Vector3 position,
                Space space, float weight = 1.0f )
public bool SetBoneLookAt ( string boneName, Vector3 position,
                Space space, float weight = 1.0f )
public bool SetBoneLookAt ( int rootUnitIndex, string boneName, Vector3 position,
                Space space, float weight = 1.0f )
Description

   Similar to the IK method, rotate the bone to view the requested position.
   Unlike SetBoneIK (), it rotates one bone.
   IK setting is not affected.


Parameters

   apOptBone optBone : Bone to control
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to control
   Vector3 position : Position to look at
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with rotation value of animated bone


Return

   bool : If it refers to a bone that does not exist, false is returned.


public bool SetBonePositionConstraint ( apOptBone optBone, float positionValue,
                ConstraintBound constraintBound, Space space )
public bool SetBonePositionConstraint ( string boneName, float positionValue,
                ConstraintBound constraintBound, Space space )
public bool SetBonePositionConstraint ( int rootUnitIndex, string boneName, float positionValue,
                ConstraintBound constraintBound, Space space )
Description

   Limit the position of the bone.
   You can set the range for each axis.
   You need to call a new one for each update, and you can make duplicate calls with different ConstraintBound types.


Parameters

   apOptBone optBone : Target Bone
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the target bone
   float positionValue : The value of the position you want to restrict
   ConstraintBound constraintBound : It has a type of "Min, Max, Preferred" for the X and Y axes, respectively.
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.


Return

   bool : If it refers to a bone that does not exist, false is returned.


public bool SetBonePositionConstraintBySurface ( apOptBone optBone,
                float defaultSurfacePosition, float currentSurfacePosition,
                float minSurfacePosition, float maxSurfacePosition,
                ConstraintSurface constraintSurface, Space space )
public bool SetBonePositionConstraintBySurface ( string boneName,
                float defaultSurfacePosition, float currentSurfacePosition,
                float minSurfacePosition, float maxSurfacePosition,
                ConstraintSurface constraintSurface, Space space )
public bool SetBonePositionConstraintBySurface ( int rootUnitIndex, string boneName,
                float defaultSurfacePosition, float currentSurfacePosition,
                float minSurfacePosition, float maxSurfacePosition,
                ConstraintSurface constraintSurface, Space space )
Description

   If you set the default surface position for the X and Y axes, and input the current surface position, the position of the bone is corrected by the difference.
   Specify the minimum and maximum ranges to ensure stable position correction.
   Since it does not control the bones directly, it has the effect of preserving the animations created with FK.


Parameters

   apOptBone optBone : Bone to control
   int rootUnitIndex : Root Unit Index (If not, search all)
   string boneName : Name of the bone to control
   float defaultSurfacePosition : The default surface position should be a generally constant value.
   float currentSurfacePosition : Position of current surface
   float minSurfacePosition : Minimum value of surface position
   float maxSurfacePosition : Maximum value of surface position
   ConstraintSurface constraintSurface : The axis of the surface (X, Y)
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.


Return

   bool : If it refers to a bone that does not exist, false is returned.