![]() |
Jopnal Engine
alpha 0.4
Simple Component Based 2D/3D Game Engine
|
#include <WheelJoint.hpp>
Public Types | |
enum | Axis { Axis::T_X, Axis::T_Y, Axis::T_Z, Axis::R_X, Axis::R_Y, Axis::R_Z } |
Public Member Functions | |
WheelJoint (World &worldRef, RigidBody &bodyA, RigidBody &bodyB, const bool collide, const float maxSteering=0.7f, const glm::quat &jRot=glm::quat(0.f, 0.f, 0.f, 0.f), const glm::vec3 &anchor=glm::vec3(0.f, 0.f, FLT_MAX)) | |
WheelJoint constructor. More... | |
float | getAngle (const Axis axis=Axis::T_Y) const |
float | getStiffness (const Axis axis=Axis::T_Y) |
WheelJoint & | setAngle (const float steeringAngle, const Axis axis=Axis::T_Y) |
Set new angle for the joint in an axis. More... | |
WheelJoint & | setStiffness (const float stiffness, const Axis axis=Axis::T_Y) |
![]() | |
Joint (World &worldRef, RigidBody &bodyA, RigidBody &bodyB, const bool collide) | |
Joint constructor. More... | |
virtual | ~Joint ()=0 |
unsigned int | getID () const |
Get joint ID. More... | |
Joint & | setID (const unsigned int id) |
Set new ID for the joint. More... | |
Additional Inherited Members | |
![]() | |
World * | m_worldRef |
Pointer to the world. More... | |
RigidBody * | m_bodyA |
Pointer to bodyA. More... | |
RigidBody * | m_bodyB |
Pointer to bodyB. More... | |
![]() | |
btRigidBody * | getBody (RigidBody &body) const |
Return engine internal pointer to body. More... | |
btDiscreteDynamicsWorld & | getWorld (World &world) const |
Return engine internal pointer to world. More... | |
glm::vec3 | defaultCenter (const glm::vec3 &jPos) const |
glm::vec3 | computeCenter () const |
Calculates the point in the middle between this' m_bodies. More... | |
![]() | |
bool | m_collide |
std::unique_ptr< btTypedConstraint > | m_joint |
< Should the linked bodies collide. More... | |
unsigned int | m_ID |
Joint ID. More... | |
Definition at line 37 of file WheelJoint.hpp.
|
strong |
T_ : Translation R_ : Rotation
Enumerator | |
---|---|
T_X | |
T_Y | |
T_Z | |
R_X | |
R_Y | |
R_Z |
Definition at line 44 of file WheelJoint.hpp.
jop::WheelJoint::WheelJoint | ( | World & | worldRef, |
RigidBody & | bodyA, | ||
RigidBody & | bodyB, | ||
const bool | collide, | ||
const float | maxSteering = 0.7f , |
||
const glm::quat & | jRot = glm::quat(0.f, 0.f, 0.f, 0.f) , |
||
const glm::vec3 & | anchor = glm::vec3(0.f, 0.f, FLT_MAX) |
||
) |
WheelJoint constructor.
When creating WheelJoints, always call the link from the chassis and pass the wheel in as the first argument.
maxSteering | Maximum steering angle of the wheel in radians. Function setAngle can not override this. Same value is set for both +/- rotations. Default is 0.7f ~ 40 degrees. |
jRot | Rotation of the joint in a quaternion. By default aligns the wheel by X- or Z-axis, depending on the global positions of the wheel and chassis. |
anchor | Position of the joint in world coordinates. Default is in the middle of the wheel. |
WheelJoint& jop::WheelJoint::setAngle | ( | const float | steeringAngle, |
const Axis | axis = Axis::T_Y |
||
) |
Set new angle for the joint in an axis.
This can not override the maxSteering of the joint.
steeringAngle | New steering angle to be set to the wheel. Negative value turns the wheel in the other direction. |
axis | Axis to change. Default Y-axis. |
WheelJoint& jop::WheelJoint::setStiffness | ( | const float | stiffness, |
const Axis | axis = Axis::T_Y |
||
) |
Set spring stiffness.
stiffness | New stiffness to apply. Please use values between 0.f - 1.f. |
axis | Axis to apply the stiffness to. Default Y. |