Difference between revisions of "B2.WheelJoint"

From GiderosMobile
Line 24: Line 24:
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Methods ===
 
=== Methods ===
[[b2.WheelJoint:enableMotor]] - enables or disables the joint motor<br/>
+
[[b2.WheelJoint:enableMotor]] {{<translate>enables or disables the joint motor</translate>}}<br/>
[[b2.WheelJoint:getJointSpeed]] - returns the current joint translation speed in meters per second.<br/>
+
[[b2.WheelJoint:getJointSpeed]] {{<translate>returns the current joint translation speed in meters per second.</translate>}}<br/>
[[b2.WheelJoint:getJointTranslation]] - returns the current joint translation in meters.<br/>
+
[[b2.WheelJoint:getJointTranslation]] {{<translate>returns the current joint translation in meters.</translate>}}<br/>
[[b2.WheelJoint:getMaxMotorTorque]] - returns the maximum motor torque in N*m<br/>
+
[[b2.WheelJoint:getMaxMotorTorque]] {{<translate>returns the maximum motor torque in N*m</translate>}}<br/>
[[b2.WheelJoint:getMotorSpeed]] - returns the motor speed in radians per second<br/>
+
[[b2.WheelJoint:getMotorSpeed]] {{<translate>returns the motor speed in radians per second</translate>}}<br/>
[[b2.WheelJoint:getSpringDampingRatio]] - returns the spring damping ratio<br/>
+
[[b2.WheelJoint:getSpringDampingRatio]] {{<translate>returns the spring damping ratio</translate>}}<br/>
[[b2.WheelJoint:getSpringFrequencyHz]] - returns the spring frequency in Hertz<br/>
+
[[b2.WheelJoint:getSpringFrequencyHz]] {{<translate>returns the spring frequency in Hertz</translate>}}<br/>
[[b2.WheelJoint:isMotorEnabled]] - is the joint motor enabled?<br/>
+
[[b2.WheelJoint:isMotorEnabled]] {{<translate>is the joint motor enabled?</translate>}}<br/>
[[b2.WheelJoint:setMaxMotorTorque]] - sets the maximum motor torque in N*m<br/>
+
[[b2.WheelJoint:setMaxMotorTorque]] {{<translate>sets the maximum motor torque in N*m</translate>}}<br/>
[[b2.WheelJoint:setMotorSpeed]] - sets the motor speed in radians per second<br/>
+
[[b2.WheelJoint:setMotorSpeed]] {{<translate>sets the motor speed in radians per second</translate>}}<br/>
[[b2.WheelJoint:setSpringDampingRatio]] - sets the spring damping ratio<br/>
+
[[b2.WheelJoint:setSpringDampingRatio]] {{<translate>sets the spring damping ratio</translate>}}<br/>
[[b2.WheelJoint:setSpringFrequencyHz]] - sets the spring frequency in Hertz (0 = disable the spring)<br/>
+
[[b2.WheelJoint:setSpringFrequencyHz]] {{<translate>sets the spring frequency in Hertz (0 = disable the spring)</translate>}}<br/>
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Events ===
 
=== Events ===
 
=== Constants ===
 
=== Constants ===
 
|}
 
|}

Revision as of 15:20, 23 August 2018

Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6

Description


A wheel joint provides two degrees of freedom: translation along an axis fixed in bodyA and rotation in the plane. You can use a
joint limit to restrict the range of motion and a joint motor to drive the rotation or to model rotational friction. This joint
is designed for vehicle suspensions.

Examples

Wheel joint

--create empty box2d body for joint
local ground = world:createBody({})
ground:setPosition(350, 480)

--axisx, 	axisy	values usually between 0 and 1
--0			0		moves freely
--0			1		force pulling back on y axis
--1			0		force pulling back on x axis
--1			1		force pulling back all diretions
local jointDef = b2.createWheelJointDef(body, ground, 350, 200, 1, 1)
local wheelJoint = world:createJoint(jointDef)

Methods

b2.WheelJoint:enableMotor Template:Enables or disables the joint motor
b2.WheelJoint:getJointSpeed Template:Returns the current joint translation speed in meters per second.
b2.WheelJoint:getJointTranslation Template:Returns the current joint translation in meters.
b2.WheelJoint:getMaxMotorTorque Template:Returns the maximum motor torque in N*m
b2.WheelJoint:getMotorSpeed Template:Returns the motor speed in radians per second
b2.WheelJoint:getSpringDampingRatio Template:Returns the spring damping ratio
b2.WheelJoint:getSpringFrequencyHz Template:Returns the spring frequency in Hertz
b2.WheelJoint:isMotorEnabled Template:Is the joint motor enabled?
b2.WheelJoint:setMaxMotorTorque Template:Sets the maximum motor torque in N*m
b2.WheelJoint:setMotorSpeed Template:Sets the motor speed in radians per second
b2.WheelJoint:setSpringDampingRatio Template:Sets the spring damping ratio
b2.WheelJoint:setSpringFrequencyHz Template:Sets the spring frequency in Hertz (0 = disable the spring)

Events

Constants