Developer   API   Game Development   Box2D   Native   b2DistanceJoint

b2DistanceJoint(native)

A distance joint constrains two points on two bodies to remain at a fixed distance from each other.

Example

this.bodyA = this.world.createBody(shape, #dynamic/*type of body*/, 1/*density*/, 1/*friction*/, 1/*bounce*/, 50/*x*/, 20/*y*/); this.bodyB = this.world.createBody(shape, #dynamic/*type of body*/, 1/*density*/, 1/*friction*/, 1/*bounce*/, 50/*x*/, 20/*y*/); var def = { dampingRatio: 0.5; //from 0 to 1 }; var (xa, ya) = this.bodyA.getWorldCenter(); var (xb, yb) = this.bodyB.getWorldCenter(); this.joint = this.world.createDistanceJoint(this.bodyA, this.bodyB, xa, ya, xb, yb, def);

Properties

  • dampingRatio : Float
    Damping ratio.
  • frequencyHz : Float
    Frequency in Hz.
  • length : Float
    The natural length. Manipulating the length can lead to non-physical behavior when the frequency is zero.
API Navigation
Skip Navigation Links.
Expand <span>User Interface</span> User Interface
Expand <span>Core & System</span> Core & System
Expand <span>Graphics</span> Graphics
Expand <span>Files and Databases</span> Files and Databases
Expand <span>Crypto</span> Crypto
Expand <span>Native User Interface</span> Native User Interface
Expand <span>Net</span> Net
Expand <span>Media</span> Media
Expand <span>Sensor</span> Sensor
Collapse <span>Game Development</span> Game Development
Collapse <span>Box2D</span> Box2D
Collapse <span>Native</span> Native
b2World
b2Body
b2Contact
b2CircleShape
b2PolygonShape
b2DistanceJoint
b2FrictionJoint
b2GearJoint
b2MouseJoint
b2PrismaticJoint
b2PulleyJoint
b2RevoluteJoint
b2WeldJoint
PhysicsWorld
PhysicsBody
PhysicsContact
PhisicsScene
PhisicsSprite
Expand <span>Animation</span> Animation
Expand <span>Game2D</span> Game2D
Expand <span>Particle System</span> Particle System
Expand <span>Scene Transition</span> Scene Transition
Game
Canvas
Bitmap
Paint