org.odejava
Class JointSlider

java.lang.Object
  extended by org.odejava.Joint
      extended by org.odejava.JointSlider

public class JointSlider
extends Joint

Created 20.12.2003 (dd.mm.yyyy)

Author:
Jani Laakso E-mail: jani.laakso@itmill.com see http://odejava.dev.java.net

Field Summary
 
Fields inherited from class org.odejava.Joint
body1, body2, BOUNCE_RANGE_MSG, deleted, feedback, group, jointGroupId, jointId, name
 
Constructor Summary
JointSlider(String name, World world)
          Create a new Slider joint that belongs to the given world and has a name.
JointSlider(String name, World world, JointGroup jointGroup)
          Create a new slider joint that belongs to the given world.
JointSlider(World world)
          Create a new Slider joint that belongs to the given world and does not belong to any group.
JointSlider(World world, JointGroup jointGroup)
          Create a new slider joint that belongs to the given world.
 
Method Summary
 org.openmali.vecmath2.Vector3f getAxis()
          Get the axis vector for the slide.
 org.openmali.vecmath2.Vector3f getAxis(org.openmali.vecmath2.Vector3f val)
          Get the axis vector for the slider and place it in the user-provided data structure.
 float getConstantForceMix()
          Get the amount of the constant force mix parameter currently set for positions between the two stops.
 float getMaximumPosition()
          Get the current maxiumum separation permitted between the two bodies.
 float getMinimumPosition()
          Get the current miniumum separation permitted between the two bodies.
 float getParam(int parameter)
          Get an unchecked parameter value directly from this joint.
 float getPosition()
          Fetch the current separation distance between the two bodies.
 float getPositionRate()
          Fetch the current rate of separation between the two bodies.
 float getStopBounce()
          Get the amount of stop bounce currently set.
 float getStopCFM()
          Get the amount of the stop constant force mix parameter currently set.
 float getStopERP()
          Get the amount of the stop error reduction parameter currently set.
 void setAxis(float x, float y, float z)
          Deprecated. use setAxis1 instead
 void setAxis1(float x, float y, float z)
           
 void setConstantForceMix(float force)
          Set the amount of constant force to mix into the system when the bodies are not at a stop.
 void setMaximumPosition(float distance)
          Set the maximum separation allowable between the two bodies.
 void setMinimumPosition(float distance)
          Set the minimum separation allowable between the two bodies.
 void setParam(int parameter, float value)
          Set a generic, unchecked, parameter directly for this joint.
 void setStopBounce(float bounce)
          Set the amount of stop bounce.
 void setStopCFM(float force)
          Set the amount of stop constant force to mix into the system when the bodies reach a stop.
 void setStopERP(float erp)
          Set the amount of stop bounce error reduction.
 
Methods inherited from class org.odejava.Joint
attach, delete, enableFeedbackTracking, enableFeedbackTracking, getBody1, getBody2, getFeedback, getGroup, getName, isFeedbackTrackingEnabled, setAxis2, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JointSlider

public JointSlider(World world)
Create a new Slider joint that belongs to the given world and does not belong to any group. The name is set to the null string.

Parameters:
world - The world that this belongs to

JointSlider

public JointSlider(String name,
                   World world)
Create a new Slider joint that belongs to the given world and has a name. The name parameter is optional. The joint is attached to the global environment.

Parameters:
name - A label string to associate with this joint
world - The world that this belongs to

JointSlider

public JointSlider(World world,
                   JointGroup jointGroup)
Create a new slider joint that belongs to the given world. The JointGroup is optional and the name is set to the null string. If no group is provided, the joint is attached to the global environment.

Parameters:
world - The world that this belongs to
jointGroup - An optional group to associate this joint with

JointSlider

public JointSlider(String name,
                   World world,
                   JointGroup jointGroup)
Create a new slider joint that belongs to the given world. The JointGroup and name parameters are optional. If no group is provided, the joint is attached to the global environment.

Parameters:
name - A label string to associate with this joint
world - The world that this belongs to
jointGroup - An optional group to associate this joint with
Method Detail

setAxis1

public void setAxis1(float x,
                     float y,
                     float z)
Overrides:
setAxis1 in class Joint

setAxis

@Deprecated
public void setAxis(float x,
                               float y,
                               float z)
Deprecated. use setAxis1 instead

Parameters:
x -
y -
z -

getAxis

public org.openmali.vecmath2.Vector3f getAxis()
Get the axis vector for the slide. A new vector instance will be created for each request. This is identical to calling getAxis(null).

Returns:
A new vector object containing the axis values

getAxis

public org.openmali.vecmath2.Vector3f getAxis(org.openmali.vecmath2.Vector3f val)
Get the axis vector for the slider and place it in the user-provided data structure. If the user-provided data structure is null, then a new instance is created and returned, otherwise the user provided structure is used as the return value.

Parameters:
val - An object to place the values into or null
Returns:
Either the val parameter or a new object

getPosition

public float getPosition()
Fetch the current separation distance between the two bodies.

Returns:
The current separation value

getPositionRate

public float getPositionRate()
Fetch the current rate of separation between the two bodies. A positive value means the separation is closing over time, a positive value is increasing separation.

Returns:
The current separation rate value

setMaximumPosition

public void setMaximumPosition(float distance)
Set the maximum separation allowable between the two bodies. This must be a non-negative number. A negative value effectively disables the joint. A value of Float.POSITIVE_INFINITY will disable the maximum extent stop.

Parameters:
distance - The maximum separation permitted between bodies

getMaximumPosition

public float getMaximumPosition()
Get the current maxiumum separation permitted between the two bodies. A value of Float.POSITIVE_INFINITY indicates that the maximum stop distance is currently disabled.

Returns:
The current maximum separation distance

setMinimumPosition

public void setMinimumPosition(float distance)
Set the minimum separation allowable between the two bodies. This must be a non-negative number. A negative value effectively disables the joint. A value of Float.NEGATIVE_INFINITY will disable the minimum extent stop.

Parameters:
distance - The minimum separation permitted between bodies

getMinimumPosition

public float getMinimumPosition()
Get the current miniumum separation permitted between the two bodies. A value of Float.NEGATIVE_INFINITY indicates that the minimum stop distance is currently disabled.

Returns:
The current minimum separation distance

setConstantForceMix

public void setConstantForceMix(float force)
Set the amount of constant force to mix into the system when the bodies are not at a stop. This value has no effect when the bodies are at one of the two stops.

Parameters:
force - The amount of force to use

getConstantForceMix

public float getConstantForceMix()
Get the amount of the constant force mix parameter currently set for positions between the two stops.

Returns:
The current constant force mix

setStopBounce

public void setStopBounce(float bounce)
                   throws IllegalArgumentException
Set the amount of stop bounce. This value must be between 0 and 1. 0 is no bounce at all, 1 is full bounce.

Parameters:
bounce - The amount of bounce to use in the range [0,1]
Throws:
IllegalArgumentException - The bounce factor is out of range

getStopBounce

public float getStopBounce()
Get the amount of stop bounce currently set. This value will be between 0 and 1. 0 is no bounce at all, 1 is full bounce.

Returns:
A value between 0 and 1

setStopERP

public void setStopERP(float erp)
Set the amount of stop bounce error reduction. This value should be between 0 and 1. 0 is no reduction at all, 1 is full correction in a single step.

Parameters:
erp - The amount of error reduction to use

getStopERP

public float getStopERP()
Get the amount of the stop error reduction parameter currently set. This value will be between 0 and 1. 0 is no reduction at all, 1 is full reduction in a single time step.

Returns:
A value between 0 and 1

setStopCFM

public void setStopCFM(float force)
Set the amount of stop constant force to mix into the system when the bodies reach a stop. This value has no effect when the bodies are not at the stops. Together with the ERP value, this can be used to get spongy or soft stops. Note that this is inteded for unpowered joints, it does not work as expected on powered joints.

Parameters:
force - The amount of force to use

getStopCFM

public float getStopCFM()
Get the amount of the stop constant force mix parameter currently set.

Returns:
The current constant force mix at the stops

setParam

public void setParam(int parameter,
                     float value)
Set a generic, unchecked, parameter directly for this joint. The parameter types that are permissable for the joint are defined by the individual joint classes and the definitions can be found in OdeConstants.

Overrides:
setParam in class Joint
Parameters:
parameter - A parameter constant from OdeConstants
value - The new value to associate with the parameter

getParam

public float getParam(int parameter)
Get an unchecked parameter value directly from this joint. The parameter types that are permissable for the joint are defined by the individual joint classes and the definitions can be found in OdeConstants.

Overrides:
getParam in class Joint
Parameters:
parameter - A constant describing the parameter to fetch
Returns:
The value of that parameter