Some Improvments to the ConeJoint Javadoc

I had a difficult time understanding how to use ConeJoints, and found the javadoc unhelpful in my learning process.



What do people think about adding some additional information?



[patch]

Index: src/jbullet/com/jme3/bullet/joints/ConeJoint.java

===================================================================

— src/jbullet/com/jme3/bullet/joints/ConeJoint.java (revision 8953)

+++ src/jbullet/com/jme3/bullet/joints/ConeJoint.java (working copy)

@@ -44,10 +44,19 @@

import java.io.IOException;



/**

    • <i>From bullet manual:</i><br>
    • To create ragdolls, the conve twist constraint is very useful for limbs like the upper arm.
    • It is a special point to point constraint that adds cone and twist axis limits.
    • The x-axis serves as twist axis.
  • @author normenhansen

    */

    public class ConeJoint extends PhysicsJoint {

    @@ -75,6 +84,12 @@

    /**
  • @param pivotA local translation of the joint connection point in node A
  • @param pivotB local translation of the joint connection point in node B
  • * @param rotA rotate the axis of symmetry of the cone from its<br />
    
  • *        default of Vector3f.UNIT_X relative to node A.  rotA<br />
    
  • *        must be a rotation matrix.<br />
    
  • * @param rotB rotate the axis of symmetry of the cone from its<br />
    
  • *        default of Vector3f.UNIT_X relative to node B.  rotB<br />
    
  • *        must be a rotation matrix.<br />
    

*/

public ConeJoint(PhysicsRigidBody nodeA, PhysicsRigidBody nodeB, Vector3f pivotA, Vector3f pivotB, Matrix3f rotA, Matrix3f rotB) {

super(nodeA, nodeB, pivotA, pivotB);

@@ -82,7 +97,26 @@

this.rotB = rotB;

createJoint();

}

-

+

  • /**
  • * Specify the shape of the ConeJoint's cone, as well as the twist<br />
    
  • * limits.<br />
    
  • *<br />
    
  • * See the &lt;a<br />
    
  •   href=&quot;http://bulletphysics.org/mediawiki-1.5.8/index.php/Constraints&quot;&gt;<br />
    
  •   bullet wiki &lt;/a&gt; for examples.<br />
    
  • * @param swingSpan1 when the axis of symmetry of the cone is at<br />
    
  • * its default of Vector3f.UNIT_X, swingSpan1 is the half angle of<br />
    
  • * the apex of the isosceles triangle made by projecting the cone<br />
    
  • * onto the XY plane. Value can range from 0 to (Math.PI / 2)<br />
    
  • * @param swingSpan2 when the axis of symmetry of the cone is at<br />
    
  • * its default of Vector3f.UNIT_X, swingSpan2 is the half angle of<br />
    
  • * the apex of the isosceles triangle made by projecting the cone<br />
    
  • * onto the XZ plane. Value can range from 0 to (Math.PI / 2)<br />
    
  • * @param twistSpan Maximum angle in radians that the two<br />
    
  • * connected bodies can twist along the axis of symmetry of the<br />
    
  • * cone. Value can range from 0 to (Math.PI * 2)<br />
    
  • */<br />
    

public void setLimit(float swingSpan1, float swingSpan2, float twistSpan) {

this.swingSpan1 = swingSpan1;

this.swingSpan2 = swingSpan2;

@@ -90,6 +124,14 @@

((ConeTwistConstraint) constraint).setLimit(swingSpan1, swingSpan2, twistSpan);

}


  • /**
  • * Sets weather the cone joint constraint should constrict the<br />
    
  • * translational degrees of freedom as in the {@link Point2PointJoint}<br />
    
  • * or leave the translational degrees of freedom free and only<br />
    
  • * affect rotational degrees of freedom.<br />
    
  • * @param value if true, leave translational DOFs free; if false,<br />
    
  • *        constrain them as in {@link Point2PointJoint}.<br />
    
  • */<br />
    

public void setAngularOnly(boolean value) {

angularOnly = value;

((ConeTwistConstraint) constraint).setAngularOnly(value);

[/patch]



sincerely,

–Robert McIntyre

2 Likes

The posting system messed up the links in the javadoc, but I think it’s clear what should be what.



An uncorrupted path can be found here :