IC Python API:RLPy RIHikEffectorComponent

From Reallusion Wiki!
Jump to: navigation, search

Main article: Modules. Last modified: 04/17/2020

Description

This class primarily manages IK skeleton controls. This component can adjust EHikEffector for various body parts i.e. RLPy.EHikEffector_LeftHand. ProcessEffector can be used move different parts of the body IK.

See Also: EHikEffector, ProcessEffector

Inheritance

RIBase > RIHikEffectorComponent 

Related Enumerations

EHikEffector

IK Effector Type Description
RLPy.EHikEffector_Invalid Invalid
RLPy.EHikEffector_LeftHand Left Hand
RLPy.EHikEffector_LeftElbow Left Elbow
RLPy.EHikEffector_LeftShoulder Left Shoulder
RLPy.EHikEffector_RightHand Right Hand
RLPy.EHikEffector_RightElbow Right Elbow
RLPy.EHikEffector_RightShoulder Right Shoulder
RLPy.EHikEffector_LeftFoot Left Foot
RLPy.EHikEffector_LeftKnee Left Knee
RLPy.EHikEffector_LeftHip Left Hip
RLPy.EHikEffector_RightFoot Right Foot
RLPy.EHikEffector_RightKnee Right Knee
RLPy.EHikEffector_RightHip Right Hip
RLPy.EHikEffector_Hip Hip
RLPy.EHikEffector_Head Head
RLPy.EHikEffector_Neck Neck
RLPy.EHikEffector_ChestOrigin Chest Origin
RLPy.EHikEffector_LeftToe Left Toe
RLPy.EHikEffector_RightToe RightToe
RLPy.EHikEffector_LeftFingerBase Left Finger Base
RLPy.EHikEffector_RightFingerBase Right Finger Base
RLPy.EHikEffector_LeftHandThumb Left Hand Thumb
RLPy.EHikEffector_LeftHandIndex Left Hand Index
RLPy.EHikEffector_LeftHandMiddle Left Hand Middle
RLPy.EHikEffector_LeftHandRing Left Hand Ring
RLPy.EHikEffector_LeftHandPinky Left Hand Pinky
RLPy.EHikEffector_LeftHandExtraFinger Left Hand Extra Finger
RLPy.EHikEffector_RightHandThumb Right Hand Thumb
RLPy.EHikEffector_RightHandIndex Right Hand Index
RLPy.EHikEffector_RightHandMiddle Right Hand Middle
RLPy.EHikEffector_RightHandRing Right Hand Ring
RLPy.EHikEffector_RightHandPinky Right Hand Pinky
RLPy.EHikEffector_RightHandExtraFinger Right Hand Extra Finger
RLPy.EHikEffector_LeftFootThumb Left Foot Thumb
RLPy.EHikEffector_LeftFootIndex Left Foot Index
RLPy.EHikEffector_LeftFootMiddle Left Foot Middle
RLPy.EHikEffector_LeftFootRing Left Foot Ring
RLPy.EHikEffector_LeftFootPinky Left Foot Pinky
RLPy.EHikEffector_LeftFootExtraFinger Left Foot Extra Finger
RLPy.EHikEffector_RightFootThumb Right Foot Thumb
RLPy.EHikEffector_RightFootIndex Right Foot Index
RLPy.EHikEffector_RightFootMiddle Right Foot Middle
RLPy.EHikEffector_RightFootRing Right Foot Ring
RLPy.EHikEffector_RightFootPinky Right Foot Pinky
RLPy.EHikEffector_RightFootExtraFinger Right Foot Extra Finger
RLPy.EHikEffector_Quantity Quantity

EHikEffectorType

IK Effector Activation Type Description
EHikEffectorType_Translate Translate
EHikEffectorType_Rotate Rotate

Member Functions

SetActive ( self, eEffector, eType, bActive )

Set the translational or rotational active state for a given IK effector.

See Also: GetActive

Parameters

eEffector [IN] IK effector on different parts of the character - EHikEffector
eType [IN] Set activation type as either translational or rotational - EHikEffectorType
bActive [IN] Activate or deactivate the IK effector - bool

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get human IK component
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 hik_effector_component = avatar.GetHikEffectorComponent()
 5 
 6 # Activate left hand effector
 7 hik_effector_component.SetActive(
 8 RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Translate, True)
 9 hik_effector_component.SetActive(
10 RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Rotate, True)

GetActive ( self, eEffector, eType )

Get the translational or rotational active state of a given IK effector.

See Also: SetActive

Parameters

eEffector [IN] IK effector for different parts of the character - EHikEffector
eType [IN] Query type of either translational or rotational - EHikEffectorType

Returns

True if the IK effector is active, else False.
1 # Get human IK component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 hik_effector_component = avatar.GetHikEffectorComponent()
5 
6 # Get human IK effector active status with translate/rotate type
7 print(hik_effector_component.GetActive(RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Translate))
8 print(hik_effector_component.GetActive(RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Rotate))

SetLock ( self, eEffector, eType, bLock )

Set the lock state of a given IK effector and transformation type (rotation or translation).

See Also: GetLock

Parameters

eEffector [IN] IK effector on different parts of the character - EHikEffector
eType [IN] Set the lock type as either translational or rotational - EHikEffectorType
bLock [IN] Lock for the IK effector - bool

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get human IK component
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 hik_effector_component = avatar.GetHikEffectorComponent()
 5 
 6 # Set effector translate lock
 7 result = hik_effector_component.SetLock(
 8 RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Translate, True);
 9 print(result)
10 
11 # Set effector rotate lock
12 result = hik_effector_component.SetLock(
13 RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Rotate, True);
14 print(result)

GetLock ( self, eEffector, eType )

Get the lock status of a given IK effector and transformation type (rotation or translation).

See Also: SetLock

Parameters

eEffector [IN] IK effector for the different parts of the character - EHikEffector
eType [IN] Query type of either rotational or translational - EHikEffectorType

Returns

True if human IK effector is locked, else False.
 1 # Get human IK component
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 hik_effector_component = avatar.GetHikEffectorComponent()
 5 
 6 # Get effector translate lock
 7 is_lock = hik_effector_component.GetLock(
 8 RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Translate);
 9 print(is_lock)
10 
11 # Get effector rotate lock
12 is_lock = hik_effector_component.GetLock(
13 RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Rotate);
14 print(is_lock)

SetPosition ( self, eEffector, kPosition )

Sets the movement (translation) of an IK effector for a body part, given an EHikEffector and a Vector3 for the X, Y, Z positions.

Parameters

eEffector [IN] IK effector for different parts of the character. - EHikEffector
kPosition [IN] Position Data - RVector3

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get human IK component
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 hik_effector_component = avatar.GetHikEffectorComponent()
 5 
 6 # Process left hand data to effector
 7 pos = RLPy.RVector3.ZERO
 8 result = hik_effector_component.SetPosition(
 9 RLPy.EHikEffector_LeftHand, pos)
10 print(result)

SetPosition ( self, eEffector, kWorldMatrix, bRotateActive, bTranslateActive )

Sets the movement and rotation of an IK effector for a body part, given an EHikEffector and world transform 4x4 matrix. This functions has the option to include/exclude rotations and translations.

Parameters

eEffector [IN] IK effector on different parts of the character - EHikEffector
kWorldMatrix [IN] World-space transformational matrix - RMatrix4
bRotateActive [IN] Whether to enable the IK rotations - bool
bTranslateActive [IN] Whether to enable the IK translations - bool

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
 1 # Get human IK component
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 hik_effector_component = avatar.GetHikEffectorComponent()
 5 
 6 # Set Effector rotation and position with matrix
 7 matrix = RLPy.RMatrix4()
 8 matrix.MakeIdentity()
 9 result = hik_effector_component.SetPosition(
10 RLPy.EHikEffector_LeftHand, matrix, true, true ); //enable R & T 
11 print(result)

ProcessEffector ( )

 1 # Get human IK component
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 hik_effector_component = avatar.GetHikEffectorComponent()
 5 # Activate left hand effector
 6 hik_effector_component.ActivateEffector(RLPy.EHikEffector_LeftHand)
 7 print(hik_effector_component.GetEffectorActive(RLPy.EHikEffector_LeftHand))
 8 # Process left hand data to effector
 9 pos_1 = RLPy.RVector3.UNIT_X
10 pos_2 = RLPy.RVector3.UNIT_Y
11 position_data = [pos_1, pos_2]
12 result = hik_effector_component.ProcessEffector(position_data)
13 print(result)

Solve ( self, eEffector, kEffectorWorldMatrix )

Given an IK effector body part ( EHikEffector ) and a transformation 4x4 matrix, return the IK effector matrix data for the entire body after having transformed the given body part.

Parameters

eEffector [IN] IK effector for different parts of the character - EHikEffector
kEffectorWorldMatrix [IN] Transformational matrix to move and rotate the Human IK effector. - RMatrix4

Return

The entire body's IK effector matrix data.
 1 # Get human IK component
 2 avatar_list = RLPy.RScene.GetAvatars()
 3 avatar = avatar_list[0]
 4 hik_effector_component = avatar.GetHikEffectorComponent()
 5 
 6 # Set effector matrix and get full body IK matrix data
 7 matrix = RLPy.RMatrix4()
 8 matrix.MakeIdentity()
 9 result = hik_effector_component.Solve( RLPy.EHikEffector_LeftHand, matrix );
10 print(result)

SetBodyWeight ( self, fWeight )

Sets the amount of influence IK effectors have on the entire body IK, from 0 to 1. A value of 0 means the IK system is driven by body parts, while 1 sets the IK effectors to full body influence.

Parameters

fWeight [IN] Weight value - float [0.0,1.0]

Return

Success - RLPy.RStatus.Success
Failure - RLPy.RStatus.Failure
1 # Get human IK component
2 avatar_list = RLPy.RScene.GetAvatars()
3 avatar = avatar_list[0]
4 hik_effector_component = avatar.GetHikEffectorComponent()
5 
6 # Set effector body weight
7 hik_effector_component.SetBodyWeight(1); # 0.0~1.0