1 /******************************************************************************* 2 * Copyright (c) 2013, Daniel Murphy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * * Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright notice, 10 * this list of conditions and the following disclaimer in the documentation 11 * and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 17 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 20 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 22 * POSSIBILITY OF SUCH DAMAGE. 23 ******************************************************************************/ 24 /** 25 * Created at 7:23:39 AM Jan 20, 2011 26 */ 27 package org.jbox2d.dynamics.joints; 28 29 import org.jbox2d.common.Vec2; 30 import org.jbox2d.dynamics.Body; 31 32 /** 33 * Friction joint definition. 34 * 35 * @author Daniel Murphy 36 */ 37 public class FrictionJointDef extends JointDef { 38 39 40 /** 41 * The local anchor point relative to bodyA's origin. 42 */ 43 public final Vec2 localAnchorA; 44 45 /** 46 * The local anchor point relative to bodyB's origin. 47 */ 48 public final Vec2 localAnchorB; 49 50 /** 51 * The maximum friction force in N. 52 */ 53 public float maxForce; 54 55 /** 56 * The maximum friction torque in N-m. 57 */ 58 public float maxTorque; 59 60 public FrictionJointDef() { 61 super(JointType.FRICTION); 62 localAnchorA = new Vec2(); 63 localAnchorB = new Vec2(); 64 maxForce = 0f; 65 maxTorque = 0f; 66 } 67 68 /** 69 * Initialize the bodies, anchors, axis, and reference angle using the world anchor and world 70 * axis. 71 */ 72 public void initialize(Body bA, Body bB, Vec2 anchor) { 73 bodyA = bA; 74 bodyB = bB; 75 bA.getLocalPointToOut(anchor, localAnchorA); 76 bB.getLocalPointToOut(anchor, localAnchorB); 77 } 78 } 79