Difference between revisions of "IC Python API:Spring Joints"

From Reallusion Wiki!
Jump to: navigation, search
m (Code Flow)
m (APIs Used)
Line 63: Line 63:
  
 
== APIs Used ==
 
== APIs Used ==
 +
 +
You can research the following references for the APIs deployed in this code.
 +
 +
=== main.py ===
 +
<div style="column-count:4; -moz-column-count:4; -webkit-column-count:4">
 +
* [[ IC_Python_API:RLPy_RPyTimerCallback#__init__ | RLPy.RPyTimerCallback.__init__() ]]
 +
* [[ IC_Python_API:RLPy_REventCallback#__init__ | RLPy.REventCallback.__init__() ]]
 +
* [[ IC_Python_API:RLPy_RDialogCallback#__init__ | RLPy.RDialogCallback.__init__() ]]
 +
* [[ IC_Python_API:RLPy_REventHandler#UnregisterCallback | RLPy.REventHandler.UnregisterCallback() ]]
 +
* [[ IC_Python_API:RLPy_RVector3 | RLPy.RVector3() ]]
 +
* [[ IC_Python_API:RLPy_RMatrix4 | RLPy.RMatrix4() ]]
 +
* [[ IC_Python_API:RLPy_RQuaternion | RLPy.RQuaternion() ]]
 +
* [[ IC_Python_API:RLPy_RMath_ACos | RLPy.RMath_ACos() ]]
 +
* [[ IC_Python_API:RLPy_RMath#AlmostZero | RLPy.RMath.AlmostZero() ]]
 +
* [[ IC_Python_API:RLPy_RMath#CONST_PI) or RLPy.RMath.AlmostZero | RLPy.RMath.CONST_PI) or RLPy.RMath.AlmostZero() ]]
 +
* [[ IC_Python_API:RLPy_RUi#GetMainWindow | RLPy.RUi.GetMainWindow() ]]
 +
* [[ IC_Python_API:RLPy_RUi#AddMenu | RLPy.RUi.AddMenu() ]]
 +
* [[ IC_Python_API:RLPy_REventHandler#RegisterCallback | RLPy.REventHandler.RegisterCallback() ]]
 +
* [[ IC_Python_API:RLPy_RGlobal#SetTime | RLPy.RGlobal.SetTime() ]]
 +
* [[ IC_Python_API:RLPy_RPyTimer | RLPy.RPyTimer() ]]
 +
* [[ IC_Python_API:RLPy_RGlobal#Play | RLPy.RGlobal.Play() ]]
 +
</div>

Revision as of 23:02, 19 January 2020

Main article: RL Python Samples.

Demo Video

Description

Spring bones allows you to apply spring physics to designated bones in the scene. The spring effect is calculated using an algorithm that takes into account several physics elements such as stiffness, bounciness, and damping. This script is versatile and can turn any existing bone or prop hierarchy into an active physics spring chain. You can also create a prop chain by attaching various props together and apply spring physics using this plugin.

Course Prerequisites

You should familiarize yourself with the following fundamental articles before you proceed:

Link Purpose

Takeaway Lessons

  • Apply spring physics to bones or attached props.
  • Create a tree list view to represent bone hierarchies.
  • Update UI by receiving callback events.
  • Using Timer events.

Required Files

  • Sample project.
  • Spring bones Python script.
  • Extensions Python script.

Usage Instructions

  1. Load or create a scene with Props attached in a required order.
  2. Move and/or rotate the objects around the scene.
  3. Load the Spring Bones script and select the desired joints in the Bones tree list view.
  4. Adjust the Stiffness, Bounciness, and Dampness settings:
    • Stiffness: how rigid are the joints?
    • Bounciness: how likely will the joints swing back and forth?
    • Dampness: how fast do the joints come to a complete stop?
  5. You could use the [Start Simulation] button to test the spring parameters and using[Stop Simulation] to stop it.
  6. After you are satisfied with your settings, click the [ Apply Setting ] button and watch the bone chain swing around as the objects moves.
  7. You could use [Clear Key] to remove the result.

Code Flow

Ic python api spring bones 03.png

APIs Used

You can research the following references for the APIs deployed in this code.

main.py