libgdx API

com.badlogic.gdx.physics.box2d.joints
Class RevoluteJoint

java.lang.Object
  extended by com.badlogic.gdx.physics.box2d.Joint
      extended by com.badlogic.gdx.physics.box2d.joints.RevoluteJoint

public class RevoluteJoint
extends Joint

A revolute joint constrains two bodies to share a common point while they are free to rotate about the point. The relative rotation about the shared point is the joint angle. You can limit the relative rotation with a joint limit that specifies a lower and upper angle. You can use a motor to drive the relative rotation about the shared point. A maximum motor torque is provided so that infinite forces are not generated.


Field Summary
 
Fields inherited from class com.badlogic.gdx.physics.box2d.Joint
addr, jointEdgeA, jointEdgeB
 
Constructor Summary
RevoluteJoint(World world, long addr)
           
 
Method Summary
 void enableLimit(boolean flag)
          Enable/disable the joint limit.
 void enableMotor(boolean flag)
          Enable/disable the joint motor.
 float getJointAngle()
          Get the current joint angle in radians.
 float getJointSpeed()
          Get the current joint angle speed in radians per second.
 float getLowerLimit()
          Get the lower joint limit in radians.
 float getMotorSpeed()
          Get the motor speed in radians per second.
 float getMotorTorque(float invDt)
          Get the current motor torque, usually in N-m.
 float getUpperLimit()
          Get the upper joint limit in radians.
 boolean isLimitEnabled()
          Is the joint limit enabled?
 boolean isMotorEnabled()
          Is the joint motor enabled?
 void setLimits(float lower, float upper)
          Set the joint limits in radians.
 void setMaxMotorTorque(float torque)
          Set the maximum motor torque, usually in N-m.
 void setMotorSpeed(float speed)
          Set the motor speed in radians per second.
 
Methods inherited from class com.badlogic.gdx.physics.box2d.Joint
getAnchorA, getAnchorB, getBodyA, getBodyB, getReactionForce, getReactionTorque, getType, isActive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RevoluteJoint

public RevoluteJoint(World world,
                     long addr)
Method Detail

getJointAngle

public float getJointAngle()
Get the current joint angle in radians.


getJointSpeed

public float getJointSpeed()
Get the current joint angle speed in radians per second.


isLimitEnabled

public boolean isLimitEnabled()
Is the joint limit enabled?


enableLimit

public void enableLimit(boolean flag)
Enable/disable the joint limit.


getLowerLimit

public float getLowerLimit()
Get the lower joint limit in radians.


getUpperLimit

public float getUpperLimit()
Get the upper joint limit in radians.


setLimits

public void setLimits(float lower,
                      float upper)
Set the joint limits in radians.

Parameters:
upper -

isMotorEnabled

public boolean isMotorEnabled()
Is the joint motor enabled?


enableMotor

public void enableMotor(boolean flag)
Enable/disable the joint motor.


setMotorSpeed

public void setMotorSpeed(float speed)
Set the motor speed in radians per second.


getMotorSpeed

public float getMotorSpeed()
Get the motor speed in radians per second.


setMaxMotorTorque

public void setMaxMotorTorque(float torque)
Set the maximum motor torque, usually in N-m.


getMotorTorque

public float getMotorTorque(float invDt)
Get the current motor torque, usually in N-m.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)