![]() |
Murl Engine Lua Addon API
Version 1.0 beta
|
The ISpring graph node interface.
Spring nodes can be used to either connect a Graph::IBody instance to a given point in world space, or to connect two separate Graph::IBody instances.
If only one body is connected to the spring (at either end), the other end point is represented by the spring's actual position in world space, defined by its Graph::ITransform interface (and its parent transform hierarchy).
Get the constant Graph::INode interface. This method returns a constant pointer to the node's Graph::INode interface, to be able to query common node properties such as active state, visibility or ID.
Murl.Graph.INode GetNodeInterface()
Get the constant Graph::ITransform interface. This method returns a constant pointer to the node's Graph::ITransform interface, to be able to query the node's transformation matrix and depth order.
Murl.Graph.ITransform GetTransformInterface()
Get the constant Graph::IBodyNodeTarget container. This method returns a constant pointer to the node's Graph::IBodyNodeTarget container, which allows to query the (up to) two bodies this spring is connected to.
Murl.Graph.IGenericNodeTarget.GraphIBody GetBodyNodeTarget()
Set the relative attachment point of a body. If a body is connected to the spring at the given index, the given position vector represents the spring's anchor point at that body, relative to the body's center.
Boolean SetBodyPosition(Integer index, Murl.Math.Vector position)
index | The body index, either 0 or 1. |
position | The anchor position relative to the body's center. |
Get the relative attachment point of a body.
Murl.Math.Vector GetBodyPosition(Integer index)
index | The body index, either 0 or 1. |
Enable/disable the spring's influence on an attached body.
Boolean SetBodyInfluence(Integer index, Boolean enabled)
index | The body index, either 0 or 1. |
enabled | If true, the attached body gets influenced by the spring. |
Check if the spring is influencing an attached body.
Boolean GetBodyInfluence(Integer index)
index | The body index, either 0 or 1. |
Set the spring constant.
Boolean SetSpringConstant(Number springConstant)
springConstant | The spring constant. |
Get the spring constant.
Number GetSpringConstant()
Set the damping constant.
Boolean SetDampingConstant(Number dampingConstant)
dampingConstant | The damping constant. |
Get the damping constant.
Number GetDampingConstant()
Set the minimum length of the spring. As long as the simulated length of the spring is between its defined minimum and maximum length, no force is applied to its attached bodies. When the spring gets compressed below its minimum length or expanded above its maximum length, a directional force is applied to restore the spring to a safe "resting length". See also SetMaximumLength().
Boolean SetMinimumLength(Number minLength)
minLength | The spring's minimum length. |
Get the minimum length of the spring.
Number GetMinimumLength()
Set the maximum length of the spring. See SetMinimumLength().
Boolean SetMaximumLength(Number maxLength)
maxLength | The spring's maximum length. |
Get the maximum length of the spring.
Number GetMaximumLength()
Enable/disable force effect.
Boolean SetForceEffectEnabled(Boolean enabled)
enabled | If false, the spring does not apply any directional force on its attached bodies. |
Check if force effect is enabled.
Boolean IsForceEffectEnabled()
Enable/disable torque effect.
Boolean SetTorqueEffectEnabled(Boolean enabled)
enabled | If false, the spring does not apply any torque on its attached bodies. |
Check if torque effect is enabled.
Boolean IsTorqueEffectEnabled()