Difference between revisions of "B2.World:createJoint"

From GiderosMobile
(alphabetical order + example of a joint)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2011.6<br/>
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Class:''' [[Special:MyLanguage/b2.World|b2.World]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/b2.World|b2.World]]<br/>
 
  
=== <translate>Description</translate> ===
+
=== Description ===
 
Creates a joint given a definition. All 10 types of joints are created by using this function:
 
Creates a joint given a definition. All 10 types of joints are created by using this function:
  
Line 11: Line 10:
 
</source>
 
</source>
  
=== <translate>Parameters</translate> ===
+
=== Parameters ===
'''jointDef''': (table) <translate></translate> <br/>
+
'''jointDef''': (table) <br/>
  
=== <translate>Return values</translate> ===
+
=== Return values ===
'''<translate>Returns</translate>''' (b2.Joint) <translate>created joint</translate><br/>
+
'''Returns''' (b2.Joint) created joint<br/>
  
 
----
 
----
  
===Revolute Joint===
+
===Distance Joint===
Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body origin rather than the center of mass because:
+
Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.
# you might not know where the center of mass will be
+
 
# if you add/remove shapes from a body and recompute the mass, the joints will be broken.
+
'''type''': (number) b2.DISTANCE_JOINT<br />
 +
'''bodyA''': (b2.Body) The first attached body.<br />
 +
'''bodyB''': (b2.Body) The second attached body.<br />
 +
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
 +
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 +
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
 +
'''length''': (number) The natural length between the anchor points. Do not use a zero or short length.<br />
 +
'''frequencyHz''': (number) The mass-spring-damper frequency in Hertz.<br />
 +
'''dampingRatio''': (number) The damping ratio. 0 = no damping, 1 = critical damping.<br />
 +
 
 +
Also, you can use [[b2.createDistanceJointDef]] function to create a distance joint definiton table easier.
 +
 
 +
===Friction Joint===
 +
Friction joint definition.
  
'''type''': (number) b2.REVOLUTE_JOINT<br />
+
'''type''': (number) b2.LINE_JOINT<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
Line 30: Line 42:
 
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
 
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
'''referenceAngle''': (number) The bodyB angle minus bodyA angle in the reference state (radians).<br />
+
'''maxForce''': (number) The maximum friction force in N.<br />
'''enableLimit''': (boolean) A flag to enable joint limits.<br />
+
'''maxTorque''': (number) The maximum friction torque in N-m.<br />
'''lowerAngle''': (number) The lower angle for the joint limit (radians).<br />
+
 
'''upperAngle''': (number) The upper angle for the joint limit (radians).<br />
+
===Gear Joint===
'''enableMotor''': (boolean) A flag to enable the joint motor.<br />
+
Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). The provided joints must attach a dynamic body to a static body.
'''motorSpeed''': (number) The desired motor speed. Usually in radians per second.<br />
+
 
'''maxMotorTorque''': (number) The maximum motor torque used to achieve the desired motor speed. Usually in N-m.<br />
+
'''type''': (number) b2.GEAR_JOINT<br />
 +
'''bodyA''': (b2.Body) The first attached body.<br />
 +
'''bodyB''': (b2.Body) The second attached body.<br />
 +
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
 +
'''joint1''': (b2.Joint) The first revolute/prismatic joint attached to the gear joint.<br />
 +
'''joint2''': (b2.Joint) The second revolute/prismatic joint attached to the gear joint.<br />
 +
'''ratio''': (number) The gear ratio.<br />
 +
 
 +
Also, you can use [[b2.createGearJointDef]] function to create a gear joint definiton table easier.
 +
 
 +
===Mouse Joint===
 +
Mouse joint definition. This requires a world target point, tuning parameters, and the time step.
 +
 
 +
'''type''': (number) b2.MOUSE_JOINT<br />
 +
'''bodyA''': (b2.Body) The first attached body.<br />
 +
'''bodyB''': (b2.Body) The second attached body.<br />
 +
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
 +
'''target''': (table) The initial world target point. This is assumed to coincide with the body anchor initially.<br />
 +
'''maxForce''': (number) The maximum constraint force that can be exerted to move the candidate body. Usually you will express as some multiple of the weight (multiplier * mass * gravity).<br />
 +
'''frequencyHz''': (number) The response speed.<br />
 +
'''dampingRatio''': (number) The damping ratio. 0 = no damping, 1 = critical damping.<br />
  
Also, you can use [[b2.createRevoluteJointDef]] function to create a revolute joint definiton table easier.
+
Also, you can use [[b2.createMouseJointDef]] function to create a mouse joint definiton table easier.
  
 
===Prismatic Joint===
 
===Prismatic Joint===
Line 59: Line 91:
  
 
Also, you can use [[b2.createPrismaticJointDef]] function to create a prismatic joint definiton table easier.
 
Also, you can use [[b2.createPrismaticJointDef]] function to create a prismatic joint definiton table easier.
 
===Distance Joint===
 
Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.
 
 
'''type''': (number) b2.DISTANCE_JOINT<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
 
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
 
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
 
'''length''': (number) The natural length between the anchor points. Do not use a zero or short length.<br />
 
'''frequencyHz''': (number) The mass-spring-damper frequency in Hertz.<br />
 
'''dampingRatio''': (number) The damping ratio. 0 = no damping, 1 = critical damping.<br />
 
 
Also, you can use [[b2.createDistanceJointDef]] function to create a distance joint definiton table easier.
 
  
 
===Pulley Joint===
 
===Pulley Joint===
Line 92: Line 109:
 
Also, you can use [[b2.createPulleyJointDef]] function to create a pulley joint definiton table easier.
 
Also, you can use [[b2.createPulleyJointDef]] function to create a pulley joint definiton table easier.
  
===Mouse Joint===
+
===Revolute Joint===
Mouse joint definition. This requires a world target point, tuning parameters, and the time step.
+
Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body origin rather than the center of mass because:
 +
# you might not know where the center of mass will be
 +
# if you add/remove shapes from a body and recompute the mass, the joints will be broken.
  
'''type''': (number) b2.MOUSE_JOINT<br />
+
'''type''': (number) b2.REVOLUTE_JOINT<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
 
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
 
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
'''target''': (table) The initial world target point. This is assumed to coincide with the body anchor initially.<br />
+
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
'''maxForce''': (number) The maximum constraint force that can be exerted to move the candidate body. Usually you will express as some multiple of the weight (multiplier * mass * gravity).<br />
+
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
'''frequencyHz''': (number) The response speed.<br />
+
'''referenceAngle''': (number) The bodyB angle minus bodyA angle in the reference state (radians).<br />
'''dampingRatio''': (number) The damping ratio. 0 = no damping, 1 = critical damping.<br />
+
'''enableLimit''': (boolean) A flag to enable joint limits.<br />
 +
'''lowerAngle''': (number) The lower angle for the joint limit (radians).<br />
 +
'''upperAngle''': (number) The upper angle for the joint limit (radians).<br />
 +
'''enableMotor''': (boolean) A flag to enable the joint motor.<br />
 +
'''motorSpeed''': (number) The desired motor speed. Usually in radians per second.<br />
 +
'''maxMotorTorque''': (number) The maximum motor torque used to achieve the desired motor speed. Usually in N-m.<br />
  
Also, you can use [[b2.createMouseJointDef]] function to create a mouse joint definiton table easier.
+
Also, you can use [[b2.createRevoluteJointDef]] function to create a revolute joint definiton table easier.
  
===Gear Joint===
+
===Rope Joint===
Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). The provided joints must attach a dynamic body to a static body.
+
Rope joint definition. This requires two body anchor points and a maximum length.
  
'''type''': (number) b2.GEAR_JOINT<br />
+
'''type''': (number) b2.ROPE_JOINT<br />
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
 
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
 
'''joint1''': (b2.Joint) The first revolute/prismatic joint attached to the gear joint.<br />
 
'''joint2''': (b2.Joint) The second revolute/prismatic joint attached to the gear joint.<br />
 
'''ratio''': (number) The gear ratio.<br />
 
 
 
Also, you can use [[b2.createGearJointDef]] function to create a gear joint definiton table easier.
 
 
 
===Wheel Joint===
 
Wheel joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
 
 
 
'''type''': (number) b2.WHEEL_JOINT<br />
 
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
Line 128: Line 139:
 
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
 
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
'''localAxisA''': (table) The local translation axis in bodyA.<br />
+
'''maxLength''': (number) The maximum length of the rope.<br />
'''enableMotor''': (boolean) A flag to enable the joint motor.<br />
 
'''maxMotorTorque''': (number) The maximum motor torque, usually in N-m.<br />
 
'''motorSpeed''': (number) The desired motor speed in radians per second.<br />
 
'''frequencyHz''': (number) Suspension frequency, zero indicates no suspension.<br />
 
'''dampingRatio''': (number) Suspension damping ratio, one indicates critical damping.<br />
 
  
Also, you can use [[b2.createWheelJointDef]] function to create a wheel joint definiton table easier.
+
Also, you can use [[b2.createRopeJointDef]] function to create a rope joint definiton table easier.
  
 
===Weld Joint===
 
===Weld Joint===
Line 150: Line 156:
 
Also, you can use [[b2.createWeldJointDef]] function to create a weld joint definiton table easier.
 
Also, you can use [[b2.createWeldJointDef]] function to create a weld joint definiton table easier.
  
===Friction Joint===
+
===Wheel Joint===
Friction joint definition.
+
Wheel joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.
  
'''type''': (number) b2.LINE_JOINT<br />
+
'''type''': (number) b2.WHEEL_JOINT<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyA''': (b2.Body) The first attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
 
'''bodyB''': (b2.Body) The second attached body.<br />
Line 159: Line 165:
 
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
 
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
 
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
'''maxForce''': (number) The maximum friction force in N.<br />
+
'''localAxisA''': (table) The local translation axis in bodyA.<br />
'''maxTorque''': (number) The maximum friction torque in N-m.<br />
+
'''enableMotor''': (boolean) A flag to enable the joint motor.<br />
 +
'''maxMotorTorque''': (number) The maximum motor torque, usually in N-m.<br />
 +
'''motorSpeed''': (number) The desired motor speed in radians per second.<br />
 +
'''frequencyHz''': (number) Suspension frequency, zero indicates no suspension.<br />
 +
'''dampingRatio''': (number) Suspension damping ratio, one indicates critical damping.<br />
  
===Rope Joint===
+
Also, you can use [[b2.createWheelJointDef]] function to create a wheel joint definiton table easier.
Rope joint definition. This requires two body anchor points and a maximum length.
 
  
'''type''': (number) b2.ROPE_JOINT<br />
+
=== Example ===
'''bodyA''': (b2.Body) The first attached body.<br />
+
<source lang="lua">
'''bodyB''': (b2.Body) The second attached body.<br />
+
local joint = xworld:createJoint({
'''collideConnected''': (boolean) Set this flag to true if the attached bodies should collide.<br />
+
type=b2.REVOLUTE_JOINT,
'''localAnchorA''': (table) The local anchor point relative to bodyA&#039;s origin.<br />
+
bodyA=prevBody, bodyB=body,
'''localAnchorB''': (table) The local anchor point relative to bodyB&#039;s origin.<br />
+
collideConnected=false,
'''maxLength''': (number) The maximum length of the rope.<br />
+
localAnchorA={x=xactorsw, y=xactorsh/2},
 
+
localAnchorB={x=0, y=xactorsh/2},
Also, you can use [[b2.createRopeJointDef]] function to create a rope joint definiton table easier.
+
-- ...
 +
})
 +
</source>
  
 
{{B2.World}}
 
{{B2.World}}

Revision as of 03:36, 5 November 2020

Available since: Gideros 2011.6
Class: b2.World

Description

Creates a joint given a definition. All 10 types of joints are created by using this function:

(b2.Joint) = b2.World:createJoint(jointDef)

Parameters

jointDef: (table)

Return values

Returns (b2.Joint) created joint


Distance Joint

Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.

type: (number) b2.DISTANCE_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
length: (number) The natural length between the anchor points. Do not use a zero or short length.
frequencyHz: (number) The mass-spring-damper frequency in Hertz.
dampingRatio: (number) The damping ratio. 0 = no damping, 1 = critical damping.

Also, you can use b2.createDistanceJointDef function to create a distance joint definiton table easier.

Friction Joint

Friction joint definition.

type: (number) b2.LINE_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
maxForce: (number) The maximum friction force in N.
maxTorque: (number) The maximum friction torque in N-m.

Gear Joint

Gear joint definition. This definition requires two existing revolute or prismatic joints (any combination will work). The provided joints must attach a dynamic body to a static body.

type: (number) b2.GEAR_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
joint1: (b2.Joint) The first revolute/prismatic joint attached to the gear joint.
joint2: (b2.Joint) The second revolute/prismatic joint attached to the gear joint.
ratio: (number) The gear ratio.

Also, you can use b2.createGearJointDef function to create a gear joint definiton table easier.

Mouse Joint

Mouse joint definition. This requires a world target point, tuning parameters, and the time step.

type: (number) b2.MOUSE_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
target: (table) The initial world target point. This is assumed to coincide with the body anchor initially.
maxForce: (number) The maximum constraint force that can be exerted to move the candidate body. Usually you will express as some multiple of the weight (multiplier * mass * gravity).
frequencyHz: (number) The response speed.
dampingRatio: (number) The damping ratio. 0 = no damping, 1 = critical damping.

Also, you can use b2.createMouseJointDef function to create a mouse joint definiton table easier.

Prismatic Joint

Prismatic joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.

type: (number) b2.PRISMATIC_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
localAxisA: (table) The local translation axis in bodyA.
referenceAngle: (number) The body2 angle minus body1 angle in the reference state (radians).
enableLimit: (boolean) A flag to enable joint limits.
lowerTranslation: (number) The lower translation limit, usually in meters.
upperTranslation: (number) The upper translation limit, usually in meters.
enableMotor: (boolean) A flag to enable the joint motor.
maxMotorForce: (number) The maximum motor torque, usually in N-m.
motorSpeed: (number) The desired motor speed in radians per second.

Also, you can use b2.createPrismaticJointDef function to create a prismatic joint definiton table easier.

Pulley Joint

Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, max lengths for each side, and a pulley ratio.

type: (number) b2.PULLEY_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
groundAnchorA: (table) The first ground anchor in world coordinates. This point never moves.
groundAnchorB: (table) The second ground anchor in world coordinates. This point never moves.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
lengthA: (number) The a reference length for the segment attached to bodyA.
lengthB: (number) The a reference length for the segment attached to bodyB.
ratio: (number) The pulley ratio, used to simulate a block-and-tackle.

Also, you can use b2.createPulleyJointDef function to create a pulley joint definiton table easier.

Revolute Joint

Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body origin rather than the center of mass because:

  1. you might not know where the center of mass will be
  2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.

type: (number) b2.REVOLUTE_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
referenceAngle: (number) The bodyB angle minus bodyA angle in the reference state (radians).
enableLimit: (boolean) A flag to enable joint limits.
lowerAngle: (number) The lower angle for the joint limit (radians).
upperAngle: (number) The upper angle for the joint limit (radians).
enableMotor: (boolean) A flag to enable the joint motor.
motorSpeed: (number) The desired motor speed. Usually in radians per second.
maxMotorTorque: (number) The maximum motor torque used to achieve the desired motor speed. Usually in N-m.

Also, you can use b2.createRevoluteJointDef function to create a revolute joint definiton table easier.

Rope Joint

Rope joint definition. This requires two body anchor points and a maximum length.

type: (number) b2.ROPE_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
maxLength: (number) The maximum length of the rope.

Also, you can use b2.createRopeJointDef function to create a rope joint definiton table easier.

Weld Joint

Weld joint definition. You need to specify local anchor points where they are attached and the relative body angle. The position of the anchor points is important for computing the reaction torque.

type: (number) b2.WELD_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
referenceAngle: (number) The bodyB angle minus bodyA angle in the reference state (radians).

Also, you can use b2.createWeldJointDef function to create a weld joint definiton table easier.

Wheel Joint

Wheel joint definition. This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space. Using local anchors and a local axis helps when saving and loading a game.

type: (number) b2.WHEEL_JOINT
bodyA: (b2.Body) The first attached body.
bodyB: (b2.Body) The second attached body.
collideConnected: (boolean) Set this flag to true if the attached bodies should collide.
localAnchorA: (table) The local anchor point relative to bodyA's origin.
localAnchorB: (table) The local anchor point relative to bodyB's origin.
localAxisA: (table) The local translation axis in bodyA.
enableMotor: (boolean) A flag to enable the joint motor.
maxMotorTorque: (number) The maximum motor torque, usually in N-m.
motorSpeed: (number) The desired motor speed in radians per second.
frequencyHz: (number) Suspension frequency, zero indicates no suspension.
dampingRatio: (number) Suspension damping ratio, one indicates critical damping.

Also, you can use b2.createWheelJointDef function to create a wheel joint definiton table easier.

Example

local joint = xworld:createJoint({
	type=b2.REVOLUTE_JOINT,
	bodyA=prevBody, bodyB=body,
	collideConnected=false,
	localAnchorA={x=xactorsw, y=xactorsh/2},
	localAnchorB={x=0, y=xactorsh/2},
	-- ...
})





LiquidFun