Murl Engine Lua Addon API  Version 1.0 beta
Murl.Graph.ISpring

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).


Table members

Methods


GetNodeInterface()

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()

Returns
Murl.Graph.INode The constant Graph::INode interface, or null if not available

GetTransformInterface()

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()

Returns
Murl.Graph.ITransform The constant Graph::ITransform interface, or null if not available

GetBodyNodeTarget()

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()

Returns
Murl.Graph.IGenericNodeTarget.GraphIBody The mutable Graph::IBodyNodeTarget container, or null if not available.

SetBodyPosition(index, position)

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)

Parameters
indexThe body index, either 0 or 1.
positionThe anchor position relative to the body's center.
Returns
Boolean true if successful.

GetBodyPosition(index)

Get the relative attachment point of a body.

Murl.Math.Vector GetBodyPosition(Integer index)

Parameters
indexThe body index, either 0 or 1.
Returns
Murl.Math.Vector The anchor position relative to the body's center.

SetBodyInfluence(index, enabled)

Enable/disable the spring's influence on an attached body.

Boolean SetBodyInfluence(Integer index, Boolean enabled)

Parameters
indexThe body index, either 0 or 1.
enabledIf true, the attached body gets influenced by the spring.
Returns
Boolean true if successful.

GetBodyInfluence(index)

Check if the spring is influencing an attached body.

Boolean GetBodyInfluence(Integer index)

Parameters
indexThe body index, either 0 or 1.
Returns
Boolean true if influence is enabled.

SetSpringConstant(springConstant)

Set the spring constant.

Boolean SetSpringConstant(Number springConstant)

Parameters
springConstantThe spring constant.
Returns
Boolean true if successful.

GetSpringConstant()

Get the spring constant.

Number GetSpringConstant()

Returns
Number The spring constant.

SetDampingConstant(dampingConstant)

Set the damping constant.

Boolean SetDampingConstant(Number dampingConstant)

Parameters
dampingConstantThe damping constant.
Returns
Boolean true if successful.

GetDampingConstant()

Get the damping constant.

Number GetDampingConstant()

Returns
Number The damping constant.

SetMinimumLength(minLength)

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)

Parameters
minLengthThe spring's minimum length.
Returns
Boolean true if successful.

GetMinimumLength()

Get the minimum length of the spring.

Number GetMinimumLength()

Returns
Number The spring's minimum length.

SetMaximumLength(maxLength)

Set the maximum length of the spring. See SetMinimumLength().

Boolean SetMaximumLength(Number maxLength)

Parameters
maxLengthThe spring's maximum length.
Returns
Boolean true if successful.

GetMaximumLength()

Get the maximum length of the spring.

Number GetMaximumLength()

Returns
Number The spring's maximum length.

SetForceEffectEnabled(enabled)

Enable/disable force effect.

Boolean SetForceEffectEnabled(Boolean enabled)

Parameters
enabledIf false, the spring does not apply any directional force on its attached bodies.
Returns
Boolean true if successful.

IsForceEffectEnabled()

Check if force effect is enabled.

Boolean IsForceEffectEnabled()

Returns
Boolean true if enabled.

SetTorqueEffectEnabled(enabled)

Enable/disable torque effect.

Boolean SetTorqueEffectEnabled(Boolean enabled)

Parameters
enabledIf false, the spring does not apply any torque on its attached bodies.
Returns
Boolean true if successful.

IsTorqueEffectEnabled()

Check if torque effect is enabled.

Boolean IsTorqueEffectEnabled()

Returns
Boolean true if enabled.