Difference between revisions of "IC Python API:RLPy RIHikEffectorComponent"

From Reallusion Wiki!
Jump to: navigation, search
m
m
 
Line 1: Line 1:
 
{{TOC}}
 
{{TOC}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
 
{{Parent|IC_Python_API:RL_Python_Modules|Modules}}
==Inheritance==
+
{{last_modified}}
This class inherits public member functions from:
+
 
*[[IC_Python_API:RLPy_RIBase|RLPy.RIBase]]
+
== Description ==
== Detailed Description ==
+
 
This class is the interface to the human IK effector in the avatar.
+
This class primarily manages IK skeleton controls.  This component can adjust [[#EHikEffector|EHikEffector]] for various body parts i.e. '''RLPy.EHikEffector_LeftHand'''.  [[#ProcessEffector ( )|ProcessEffector]] can be used move different parts of the body IK.
<span style="background:#ffcccc">( Experimental Class )</span> <syntaxhighlight lang="Python">
+
 
 +
See Also: [[#EHikEffector|EHikEffector]], [[#ProcessEffector ( )|ProcessEffector]]
 +
 
 +
=== Inheritance ===
 +
 
 +
[[IC_Python_API:RLPy_RIBase|RIBase]] > [[IC_Python_API:RLPy_RIHikEffectorComponent|RIHikEffectorComponent]]  
 +
 
 +
== Related Enumerations ==
 +
 
 +
=== EHikEffector ===
 +
 
 +
{|class="wikitable"
 +
!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 ===
 +
 
 +
{|class="wikitable"
 +
!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 ( self, eEffector, eType )|GetActive]]
 +
 
 +
==== Parameters ====
 +
:'''eEffector''' [IN] IK effector on different parts of the character - [[#EHikEffector|EHikEffector]]
 +
:'''eType''' [IN] Set activation type as either translational or rotational - [[#EHikEffectorType|EHikEffectorType]]
 +
:'''bActive''' [IN] Activate or deactivate the IK effector - bool
 +
 
 +
==== Return ====
 +
:Success - RLPy.RStatus.Success
 +
:Failure - RLPy.RStatus.Failure
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 
# Get human IK component
 
# Get human IK component
 
avatar_list = RLPy.RScene.GetAvatars()
 
avatar_list = RLPy.RScene.GetAvatars()
Line 13: Line 197:
  
 
# Activate left hand effector
 
# Activate left hand effector
hik_effector_component.ActivateEffector(RLPy.EHikEffector_LeftHand)
+
hik_effector_component.SetActive(
print(hik_effector_component.GetEffectorActive(RLPy.EHikEffector_LeftHand))
+
RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Translate, True)
 
+
hik_effector_component.SetActive(
# Process left hand data to effector
+
RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Rotate, True)
pos_1 = RLPy.RVector3.UNIT_X
+
pos_2 = RLPy.RVector3.UNIT_Y
+
position_data = [pos_1, pos_2]
+
result = hik_effector_component.ProcessEffector(position_data)
+
print(result)
+
</syntaxhighlight>
+
== Member Functions ==
+
=== ActivateEffector ===
+
<syntaxhighlight lang="Python">
+
RLPy.RIHikEffectorComponent.ActivateEffector ( self, args )
+
 
</syntaxhighlight>
 
</syntaxhighlight>
Activate human IK effector with lock translate and rotate status.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
==== Parameters ====
 
<div style="margin-left: 2em;">
 
'''eEffector''' [IN] Human IK effector - RLPy.EHikEffector
 
*'''RLPy.EHikEffector_Invalid'''
 
*'''RLPy.EHikEffector_LeftHand'''
 
*'''RLPy.EHikEffector_LeftElbow'''
 
*'''RLPy.EHikEffector_LeftShoulder'''
 
*'''RLPy.EHikEffector_RightHand'''
 
*'''RLPy.EHikEffector_RightElbow'''
 
*'''RLPy.EHikEffector_RightShoulder'''
 
*'''RLPy.EHikEffector_LeftFoot'''
 
*'''RLPy.EHikEffector_LeftKnee'''
 
*'''RLPy.EHikEffector_LeftHip'''
 
*'''RLPy.EHikEffector_RightFoot'''
 
*'''RLPy.EHikEffector_RightKnee'''
 
*'''RLPy.EHikEffector_RightHip'''
 
*'''RLPy.EHikEffector_Hip'''
 
*'''RLPy.EHikEffector_Head'''
 
*'''RLPy.EHikEffector_Neck'''
 
*'''RLPy.EHikEffector_ChestOrigin'''
 
*'''RLPy.EHikEffector_LeftToe'''
 
*'''RLPy.EHikEffector_RightToe'''
 
*'''RLPy.EHikEffector_LeftFingerBase'''
 
*'''RLPy.EHikEffector_RightFingerBase'''
 
*'''RLPy.EHikEffector_Quantity'''
 
  
'''bLockTranslate''' [IN] Lock translate status - bool
+
=== GetActive ( self, eEffector, eType ) ===
  
'''bLockRotate''' [IN] Lock rotate status - bool
+
Get the translational or rotational active state of a given IK effector.
</div>
+
 
==== Return Values ====
+
See Also: [[#SetActive ( self, eEffector, eType, bActive )|SetActive]]
<div style="margin-left: 2em;">
+
'''RLPy.RStatus.Success''' Success
+
  
'''RLPy.RStatus.Failure''' Fail
 
</div>
 
-----
 
=== DeactivateEffector ===
 
<syntaxhighlight lang="Python">
 
RLPy.RIHikEffectorComponent.DeactivateEffector ( self, eEffector )
 
</syntaxhighlight>
 
Deactivate human IK effector.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
 
==== Parameters ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:'''eEffector''' [IN] IK effector for different parts of the character - [[#EHikEffector|EHikEffector]]
'''eEffector''' [IN] Human IK effector - RLPy.EHikEffector
+
:'''eType''' [IN] Query type of either translational or rotational - [[#EHikEffectorType|EHikEffectorType]]
*'''RLPy.EHikEffector_Invalid'''
+
*'''RLPy.EHikEffector_LeftHand'''
+
*'''RLPy.EHikEffector_LeftElbow'''
+
*'''RLPy.EHikEffector_LeftShoulder'''
+
*'''RLPy.EHikEffector_RightHand'''
+
*'''RLPy.EHikEffector_RightElbow'''
+
*'''RLPy.EHikEffector_RightShoulder'''
+
*'''RLPy.EHikEffector_LeftFoot'''
+
*'''RLPy.EHikEffector_LeftKnee'''
+
*'''RLPy.EHikEffector_LeftHip'''
+
*'''RLPy.EHikEffector_RightFoot'''
+
*'''RLPy.EHikEffector_RightKnee'''
+
*'''RLPy.EHikEffector_RightHip'''
+
*'''RLPy.EHikEffector_Hip'''
+
*'''RLPy.EHikEffector_Head'''
+
*'''RLPy.EHikEffector_Neck'''
+
*'''RLPy.EHikEffector_ChestOrigin'''
+
*'''RLPy.EHikEffector_LeftToe'''
+
*'''RLPy.EHikEffector_RightToe'''
+
*'''RLPy.EHikEffector_LeftFingerBase'''
+
*'''RLPy.EHikEffector_RightFingerBase'''
+
*'''RLPy.EHikEffector_Quantity'''
+
</div>
+
==== Return Values ====
+
<div style="margin-left: 2em;">
+
'''RLPy.RStatus.Success''' Success
+
  
'''RLPy.RStatus.Failure''' Fail
 
</div>
 
-----
 
=== GetActivatedEffector ===
 
<syntaxhighlight lang="Python">
 
RLPy.RIHikEffectorComponent.GetActivatedEffector ( self )
 
</syntaxhighlight>
 
Get activated human IK effector.
 
<span style="background:#ffcccc">( Experimental API )</span>
 
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:'''True''' if the IK effector is active, else '''False'''.
Activated human IK effector - int
+
 
</div>
+
<syntaxhighlight lang="python" line='line'>
-----
+
# Get human IK component
=== GetEffectorActive ===
+
avatar_list = RLPy.RScene.GetAvatars()
<syntaxhighlight lang="Python">
+
avatar = avatar_list[0]
RLPy.RIHikEffectorComponent.GetEffectorActive ( self, eEffector )
+
hik_effector_component = avatar.GetHikEffectorComponent()
 +
 
 +
# Get human IK effector active status with translate/rotate type
 +
print(hik_effector_component.GetActive(RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Translate))
 +
print(hik_effector_component.GetActive(RLPy.EHikEffector_LeftHand, RLPy.EHikEffectorType_Rotate))
 
</syntaxhighlight>
 
</syntaxhighlight>
Get human IK effector active status.
+
 
<span style="background:#ffcccc">( Experimental API )</span>
+
=== SetLock ( self, eEffector, eType, bLock ) ===
 +
 
 +
Set the lock state of a given IK effector and transformation type (rotation or translation).
 +
 
 +
See Also: [[#GetLock ( self, eEffector, eType )|GetLock]]
 +
 
 
==== Parameters ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:'''eEffector''' [IN] IK effector on different parts of the character - [[#EHikEffector|EHikEffector]]
'''eEffector''' [IN] Human IK effector - RLPy.EHikEffector
+
:'''eType''' [IN] Set the lock type as either translational or rotational - [[#EHikEffectorType|EHikEffectorType]]
*'''RLPy.EHikEffector_Invalid'''
+
:'''bLock''' [IN] Lock for the IK effector - bool
*'''RLPy.EHikEffector_LeftHand'''
+
 
*'''RLPy.EHikEffector_LeftElbow'''
+
==== Return ====
*'''RLPy.EHikEffector_LeftShoulder'''
+
:Success - RLPy.RStatus.Success
*'''RLPy.EHikEffector_RightHand'''
+
:Failure - RLPy.RStatus.Failure
*'''RLPy.EHikEffector_RightElbow'''
+
 
*'''RLPy.EHikEffector_RightShoulder'''
+
<syntaxhighlight lang="python" line='line'>
*'''RLPy.EHikEffector_LeftFoot'''
+
# Get human IK component
*'''RLPy.EHikEffector_LeftKnee'''
+
avatar_list = RLPy.RScene.GetAvatars()
*'''RLPy.EHikEffector_LeftHip'''
+
avatar = avatar_list[0]
*'''RLPy.EHikEffector_RightFoot'''
+
hik_effector_component = avatar.GetHikEffectorComponent()
*'''RLPy.EHikEffector_RightKnee'''
+
 
*'''RLPy.EHikEffector_RightHip'''
+
# Set effector translate lock
*'''RLPy.EHikEffector_Hip'''
+
result = hik_effector_component.SetLock(
*'''RLPy.EHikEffector_Head'''
+
RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Translate, True);
*'''RLPy.EHikEffector_Neck'''
+
print(result)
*'''RLPy.EHikEffector_ChestOrigin'''
+
 
*'''RLPy.EHikEffector_LeftToe'''
+
# Set effector rotate lock
*'''RLPy.EHikEffector_RightToe'''
+
result = hik_effector_component.SetLock(
*'''RLPy.EHikEffector_LeftFingerBase'''
+
RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Rotate, True);
*'''RLPy.EHikEffector_RightFingerBase'''
+
print(result)
*'''RLPy.EHikEffector_Quantity'''
+
</div>
+
==== Returns ====
+
<div style="margin-left: 2em;">
+
True if human IK effector is active, False if human IK effector is not active - bool
+
</div>
+
-----
+
=== GetEffectorLockRotate ===
+
<syntaxhighlight lang="Python">
+
RLPy.RIHikEffectorComponent.GetEffectorLockRotate ( self, eEffector )
+
 
</syntaxhighlight>
 
</syntaxhighlight>
Get human IK effector lock rotate status.
+
 
<span style="background:#ffcccc">( Experimental API )</span>
+
=== GetLock ( self, eEffector, eType ) ===
 +
 
 +
Get the lock status of a given IK effector and transformation type (rotation or translation).
 +
 
 +
See Also: [[#SetLock ( self, eEffector, eType, bLock )|SetLock]]
 +
 
 
==== Parameters ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:'''eEffector''' [IN] IK effector for the different parts of the character - [[#EHikEffector|EHikEffector]]
'''eEffector''' [IN] Human IK effector - RLPy.EHikEffector
+
:'''eType''' [IN] Query type of either rotational or translational - [[#EHikEffectorType|EHikEffectorType]]
*'''RLPy.EHikEffector_Invalid'''
+
 
*'''RLPy.EHikEffector_LeftHand'''
+
*'''RLPy.EHikEffector_LeftElbow'''
+
*'''RLPy.EHikEffector_LeftShoulder'''
+
*'''RLPy.EHikEffector_RightHand'''
+
*'''RLPy.EHikEffector_RightElbow'''
+
*'''RLPy.EHikEffector_RightShoulder'''
+
*'''RLPy.EHikEffector_LeftFoot'''
+
*'''RLPy.EHikEffector_LeftKnee'''
+
*'''RLPy.EHikEffector_LeftHip'''
+
*'''RLPy.EHikEffector_RightFoot'''
+
*'''RLPy.EHikEffector_RightKnee'''
+
*'''RLPy.EHikEffector_RightHip'''
+
*'''RLPy.EHikEffector_Hip'''
+
*'''RLPy.EHikEffector_Head'''
+
*'''RLPy.EHikEffector_Neck'''
+
*'''RLPy.EHikEffector_ChestOrigin'''
+
*'''RLPy.EHikEffector_LeftToe'''
+
*'''RLPy.EHikEffector_RightToe'''
+
*'''RLPy.EHikEffector_LeftFingerBase'''
+
*'''RLPy.EHikEffector_RightFingerBase'''
+
*'''RLPy.EHikEffector_Quantity'''
+
</div>
+
 
==== Returns ====
 
==== Returns ====
<div style="margin-left: 2em;">
+
:'''True''' if human IK effector is locked, else '''False'''.
True if human IK effector rotate status is locked, False if human IK effector rotate is unlocked - bool
+
 
</div>
+
<syntaxhighlight lang="python" line='line'>
-----
+
# Get human IK component
=== GetEffectorLockTranslate ===
+
avatar_list = RLPy.RScene.GetAvatars()
<syntaxhighlight lang="Python">
+
avatar = avatar_list[0]
RLPy.RIHikEffectorComponent.GetEffectorLockTranslate ( self, eEffector )
+
hik_effector_component = avatar.GetHikEffectorComponent()
 +
 
 +
# Get effector translate lock
 +
is_lock = hik_effector_component.GetLock(
 +
RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Translate);
 +
print(is_lock)
 +
 
 +
# Get effector rotate lock
 +
is_lock = hik_effector_component.GetLock(
 +
RLPy.EHikEffector_Head, RLPy.EHikEffectorType_Rotate);
 +
print(is_lock)
 
</syntaxhighlight>
 
</syntaxhighlight>
Get human IK effector lock translate status.
+
 
<span style="background:#ffcccc">( Experimental API )</span>
+
=== SetPosition ( self, eEffector, kPosition ) ===
 +
 
 +
Sets the movement (translation) of an IK effector for a body part, given an [[#EHikEffector|EHikEffector]] and a Vector3 for the X, Y, Z positions.
 +
 
 
==== Parameters ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:'''eEffector''' [IN] IK effector for different parts of the character. - [[#EHikEffector|EHikEffector]]
'''eEffector''' [IN] Human IK effector - RLPy.EHikEffector
+
:'''kPosition''' [IN] Position Data - [[IC_Python_API:RLPy_RVector3|RVector3]]
*'''RLPy.EHikEffector_Invalid'''
+
 
*'''RLPy.EHikEffector_LeftHand'''
+
==== Return ====
*'''RLPy.EHikEffector_LeftElbow'''
+
:Success - RLPy.RStatus.Success
*'''RLPy.EHikEffector_LeftShoulder'''
+
:Failure - RLPy.RStatus.Failure
*'''RLPy.EHikEffector_RightHand'''
+
 
*'''RLPy.EHikEffector_RightElbow'''
+
<syntaxhighlight lang="python" line='line'>
*'''RLPy.EHikEffector_RightShoulder'''
+
# Get human IK component
*'''RLPy.EHikEffector_LeftFoot'''
+
avatar_list = RLPy.RScene.GetAvatars()
*'''RLPy.EHikEffector_LeftKnee'''
+
avatar = avatar_list[0]
*'''RLPy.EHikEffector_LeftHip'''
+
hik_effector_component = avatar.GetHikEffectorComponent()
*'''RLPy.EHikEffector_RightFoot'''
+
 
*'''RLPy.EHikEffector_RightKnee'''
+
# Process left hand data to effector
*'''RLPy.EHikEffector_RightHip'''
+
pos = RLPy.RVector3.ZERO
*'''RLPy.EHikEffector_Hip'''
+
result = hik_effector_component.SetPosition(
*'''RLPy.EHikEffector_Head'''
+
RLPy.EHikEffector_LeftHand, pos)
*'''RLPy.EHikEffector_Neck'''
+
print(result)
*'''RLPy.EHikEffector_ChestOrigin'''
+
*'''RLPy.EHikEffector_LeftToe'''
+
*'''RLPy.EHikEffector_RightToe'''
+
*'''RLPy.EHikEffector_LeftFingerBase'''
+
*'''RLPy.EHikEffector_RightFingerBase'''
+
*'''RLPy.EHikEffector_Quantity'''
+
</div>
+
==== Returns ====
+
<div style="margin-left: 2em;">
+
True if human IK effector translate status is locked, False if human IK effector translate is unlocked - bool
+
</div>
+
-----
+
=== ProcessEffector ===
+
<syntaxhighlight lang="Python">
+
RLPy.RIHikEffectorComponent.ProcessEffector ( self, args )
+
 
</syntaxhighlight>
 
</syntaxhighlight>
Process world matrix to human IK effector.
+
 
<span style="background:#ffcccc">( Experimental API )</span>
+
=== SetPosition ( self, eEffector, kWorldMatrix, bRotateActive, bTranslateActive ) ===
 +
 
 +
Sets the movement and rotation of an IK effector for a body part, given an [[#EHikEffector|EHikEffector]] and world transform 4x4 matrix.  This functions has the option to include/exclude rotations and translations.
 +
 
 
==== Parameters ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:'''eEffector''' [IN] IK effector on different parts of the character - [[#EHikEffector|EHikEffector]]
'''kWorldMatrix''' [IN] World matrix - RLPy.RMatrix4f
+
:'''kWorldMatrix''' [IN] World-space transformational matrix - [[IC_Python_API:RLPy_RMatrix4|RMatrix4]]
</div>
+
:'''bRotateActive''' [IN] Whether to enable the IK rotations - bool
==== Return Values ====
+
:'''bTranslateActive''' [IN] Whether to enable the IK translations - bool
<div style="margin-left: 2em;">
+
'''RLPy.RStatus.Success''' Success
+
  
'''RLPy.RStatus.Failure''' Fail
+
==== Return ====
</div>
+
:Success - RLPy.RStatus.Success
-----
+
:Failure - RLPy.RStatus.Failure
=== SetEffectorLockRotate ===
+
 
<syntaxhighlight lang="Python">
+
<syntaxhighlight lang="python" line='line'>
RLPy.RIHikEffectorComponent.SetEffectorLockRotate ( self, eEffector, bLock )
+
# Get human IK component
 +
avatar_list = RLPy.RScene.GetAvatars()
 +
avatar = avatar_list[0]
 +
hik_effector_component = avatar.GetHikEffectorComponent()
 +
 
 +
# Set Effector rotation and position with matrix
 +
matrix = RLPy.RMatrix4()
 +
matrix.MakeIdentity()
 +
result = hik_effector_component.SetPosition(
 +
RLPy.EHikEffector_LeftHand, matrix, true, true ); //enable R & T
 +
print(result)
 
</syntaxhighlight>
 
</syntaxhighlight>
Set human IK effector lock rotate status.
+
 
<span style="background:#ffcccc">( Experimental API )</span>
+
=== ProcessEffector ( ) ===
 +
 
 +
<syntaxhighlight lang="python" line='line'>
 +
# Get human IK component
 +
avatar_list = RLPy.RScene.GetAvatars()
 +
avatar = avatar_list[0]
 +
hik_effector_component = avatar.GetHikEffectorComponent()
 +
# Activate left hand effector
 +
hik_effector_component.ActivateEffector(RLPy.EHikEffector_LeftHand)
 +
print(hik_effector_component.GetEffectorActive(RLPy.EHikEffector_LeftHand))
 +
# Process left hand data to effector
 +
pos_1 = RLPy.RVector3.UNIT_X
 +
pos_2 = RLPy.RVector3.UNIT_Y
 +
position_data = [pos_1, pos_2]
 +
result = hik_effector_component.ProcessEffector(position_data)
 +
print(result)
 +
</syntaxhighlight>
 +
 
 +
=== Solve ( self, eEffector, kEffectorWorldMatrix ) ===
 +
 
 +
Given an IK effector body part ( [[#EHikEffector|EHikEffector]] ) and a transformation 4x4 matrix, return the IK effector matrix data for the entire body after having transformed the given body part.
 +
 
 
==== Parameters ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:'''eEffector''' [IN] IK effector for different parts of the character - [[#EHikEffector|EHikEffector]]
'''eEffector''' [IN] Human IK effector - RLPy.EHikEffector
+
:'''kEffectorWorldMatrix''' [IN] Transformational matrix to move and rotate the Human IK effector. - [[IC_Python_API:RLPy_RMatrix4|RMatrix4]]
*'''RLPy.EHikEffector_Invalid'''
+
*'''RLPy.EHikEffector_LeftHand'''
+
*'''RLPy.EHikEffector_LeftElbow'''
+
*'''RLPy.EHikEffector_LeftShoulder'''
+
*'''RLPy.EHikEffector_RightHand'''
+
*'''RLPy.EHikEffector_RightElbow'''
+
*'''RLPy.EHikEffector_RightShoulder'''
+
*'''RLPy.EHikEffector_LeftFoot'''
+
*'''RLPy.EHikEffector_LeftKnee'''
+
*'''RLPy.EHikEffector_LeftHip'''
+
*'''RLPy.EHikEffector_RightFoot'''
+
*'''RLPy.EHikEffector_RightKnee'''
+
*'''RLPy.EHikEffector_RightHip'''
+
*'''RLPy.EHikEffector_Hip'''
+
*'''RLPy.EHikEffector_Head'''
+
*'''RLPy.EHikEffector_Neck'''
+
*'''RLPy.EHikEffector_ChestOrigin'''
+
*'''RLPy.EHikEffector_LeftToe'''
+
*'''RLPy.EHikEffector_RightToe'''
+
*'''RLPy.EHikEffector_LeftFingerBase'''
+
*'''RLPy.EHikEffector_RightFingerBase'''
+
*'''RLPy.EHikEffector_Quantity'''
+
  
'''bLock''' [IN] Lock rotate status - bool
+
==== Return ====
</div>
+
:The entire body's IK effector matrix data.
==== Return Values ====
+
<div style="margin-left: 2em;">
+
'''RLPy.RStatus.Success''' Success
+
  
'''RLPy.RStatus.Failure''' Fail
+
<syntaxhighlight lang="python" line='line'>
</div>
+
# Get human IK component
-----
+
avatar_list = RLPy.RScene.GetAvatars()
=== SetEffectorLockTranslate ===
+
avatar = avatar_list[0]
<syntaxhighlight lang="Python">
+
hik_effector_component = avatar.GetHikEffectorComponent()
RLPy.RIHikEffectorComponent.SetEffectorLockTranslate ( self, eEffector, bLock )
+
 
 +
# Set effector matrix and get full body IK matrix data
 +
matrix = RLPy.RMatrix4()
 +
matrix.MakeIdentity()
 +
result = hik_effector_component.Solve( RLPy.EHikEffector_LeftHand, matrix );
 +
print(result)
 
</syntaxhighlight>
 
</syntaxhighlight>
Set human IK effector lock translate status.
+
 
<span style="background:#ffcccc">( Experimental API )</span>
+
=== 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 ====
 
==== Parameters ====
<div style="margin-left: 2em;">
+
:'''fWeight''' [IN] Weight value - float [0.0,1.0]
'''eEffector''' [IN] Human IK effector - RLPy.EHikEffector
+
*'''RLPy.EHikEffector_Invalid'''
+
*'''RLPy.EHikEffector_LeftHand'''
+
*'''RLPy.EHikEffector_LeftElbow'''
+
*'''RLPy.EHikEffector_LeftShoulder'''
+
*'''RLPy.EHikEffector_RightHand'''
+
*'''RLPy.EHikEffector_RightElbow'''
+
*'''RLPy.EHikEffector_RightShoulder'''
+
*'''RLPy.EHikEffector_LeftFoot'''
+
*'''RLPy.EHikEffector_LeftKnee'''
+
*'''RLPy.EHikEffector_LeftHip'''
+
*'''RLPy.EHikEffector_RightFoot'''
+
*'''RLPy.EHikEffector_RightKnee'''
+
*'''RLPy.EHikEffector_RightHip'''
+
*'''RLPy.EHikEffector_Hip'''
+
*'''RLPy.EHikEffector_Head'''
+
*'''RLPy.EHikEffector_Neck'''
+
*'''RLPy.EHikEffector_ChestOrigin'''
+
*'''RLPy.EHikEffector_LeftToe'''
+
*'''RLPy.EHikEffector_RightToe'''
+
*'''RLPy.EHikEffector_LeftFingerBase'''
+
*'''RLPy.EHikEffector_RightFingerBase'''
+
*'''RLPy.EHikEffector_Quantity'''
+
  
'''bLock''' [IN] Lock translate status - bool
+
==== Return ====
</div>
+
:Success - RLPy.RStatus.Success
==== Return Values ====
+
:Failure - RLPy.RStatus.Failure
<div style="margin-left: 2em;">
+
'''RLPy.RStatus.Success''' Success
+
  
'''RLPy.RStatus.Failure''' Fail
+
<syntaxhighlight lang="python" line='line'>
</div>
+
# Get human IK component
 +
avatar_list = RLPy.RScene.GetAvatars()
 +
avatar = avatar_list[0]
 +
hik_effector_component = avatar.GetHikEffectorComponent()
 +
 
 +
# Set effector body weight
 +
hik_effector_component.SetBodyWeight(1); # 0.0~1.0
 +
</syntaxhighlight>

Latest revision as of 01:05, 17 April 2020

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