Tramway SDK
|
#include <physics.h>
Public Member Functions | |
PhysicsComponent () | |
~PhysicsComponent () | |
void | EventHandler (Event &event) |
void | Start () |
name_t | GetModel () |
Returns the name of the collision model. More... | |
void | SetModel (name_t model) |
Sets the collision model. More... | |
void | SetMass (float mass) |
Sets the mass of the physics object. More... | |
void | SetShape (Physics::CollisionShape shape) |
Sets the collision shape of the physics object. More... | |
void | Push (vec3 direction) |
Pushes the physics object. More... | |
void | Push (vec3 direction, vec3 local_position) |
void | Spin (vec3 direction) |
void | SetCollisionMask (uint32_t flags) |
Sets the collision mask of the physics object. More... | |
void | SetCollisionGroup (uint32_t flags) |
Sets the collision group of the physics object. More... | |
uint32_t | GetCollisionMask () |
Returns the collision mask. More... | |
uint32_t | GetCollisionGroup () |
Returns the collision group. More... | |
void | SetDebugDrawing (bool drawing) |
Sets the debug drawing of a physics object. More... | |
void | SetKinematic (bool kinematic) |
Sets the physics object to kinematic. More... | |
void | SetUpdateParentTransform (bool update) |
Sets whether the movement of the rigibody should update parent Entity's transform. More... | |
void | SetRotation (quat rotation) |
Sets the rotation of the physics object. More... | |
void | SetLocation (vec3 location) |
Sets the position of the physics object. More... | |
void | DisableDeactivation () |
Disables deactivation of the object. More... | |
void | Awaken () |
Awakens the object. More... | |
void | Sleep () |
Puts the object to sleep. More... | |
void | SetAngularFactor (vec3 factor) |
Sets the angular factor of the physics object. More... | |
void | SetLinearFactor (vec3 factor) |
Sets the angular factor of the physics object. More... | |
void | SetVelocity (const vec3 &velocity) |
Sets the velocity of the physics object. More... | |
vec3 | GetVelocity () |
Returns the velocity of the physics object. More... | |
Public Member Functions inherited from tram::EntityComponent | |
EntityComponent () | |
virtual | ~EntityComponent () |
virtual void | Init () |
bool | IsReady () |
bool | IsInit () |
Entity * | GetParent () |
void | SetParent (Entity *parent) |
Additional Inherited Members | |
Protected Member Functions inherited from tram::EntityComponent | |
void | ResourceReady () |
Protected Attributes inherited from tram::EntityComponent | |
size_t | resources_waiting = 0 |
bool | is_ready = false |
bool | is_init = false |
Entity * | parent = nullptr |
|
inline |
tram::PhysicsComponent::~PhysicsComponent | ( | ) |
void tram::PhysicsComponent::Awaken | ( | ) |
Awakens the object.
void tram::PhysicsComponent::DisableDeactivation | ( | ) |
Disables deactivation of the object.
This makes the object to never fall asleep.
|
inlinevirtual |
Implements tram::EntityComponent.
uint32_t tram::PhysicsComponent::GetCollisionGroup | ( | ) |
Returns the collision group.
See SetCollisionGroup() for more information.
uint32_t tram::PhysicsComponent::GetCollisionMask | ( | ) |
Returns the collision mask.
See SetCollisionMask() for more information.
name_t tram::PhysicsComponent::GetModel | ( | ) |
Returns the name of the collision model.
vec3 tram::PhysicsComponent::GetVelocity | ( | ) |
Returns the velocity of the physics object.
Always returns zero velocity if component is not loaded.
void tram::PhysicsComponent::Push | ( | vec3 | direction | ) |
Pushes the physics object.
I have no idea what the units are. Direction of direction is the direction into which the object will be pushed and the length of the vector is the force of the push.
void tram::PhysicsComponent::SetAngularFactor | ( | vec3 | factor | ) |
Sets the angular factor of the physics object.
Changes how much the object will rotate around the x, y, z axes. Can be used to restrict rotation around certain axes.
void tram::PhysicsComponent::SetCollisionGroup | ( | uint32_t | flags | ) |
Sets the collision group of the physics object.
Collision group is a bitmask. A physics object will only collide with an another object if their collision group and collision mask bitmasks have at least one bit in common, i.e. they will be bitwise and'ed together.
void tram::PhysicsComponent::SetCollisionMask | ( | uint32_t | flags | ) |
Sets the collision mask of the physics object.
Collision mask is a bitmask. A physics object will only collide with an another object if their collision group and collision mask bitmasks have at least one bit in common, i.e. they will be bitwise and'ed together.
void tram::PhysicsComponent::SetDebugDrawing | ( | bool | drawing | ) |
Sets the debug drawing of a physics object.
Set to false, if you don't want the physics object to show up when drawing physics debug.
void tram::PhysicsComponent::SetKinematic | ( | bool | kinematic | ) |
Sets the physics object to kinematic.
If set to kinematic, then the physics object will poll its parent entity for its position, instead of simulated and pushing its position into its parent entity.
void tram::PhysicsComponent::SetLinearFactor | ( | vec3 | factor | ) |
Sets the angular factor of the physics object.
Changes how much the object will move along the x, y, z axes. Can be used to restrict movement along certain axes.
void tram::PhysicsComponent::SetLocation | ( | vec3 | location | ) |
Sets the position of the physics object.
void tram::PhysicsComponent::SetMass | ( | float | mass | ) |
Sets the mass of the physics object.
Mass specified in kilograms. If the mass is set to 0, then it's assumed to be infinite, and the object will become static and immovable.
void tram::PhysicsComponent::SetModel | ( | name_t | model | ) |
Sets the collision model.
void tram::PhysicsComponent::SetRotation | ( | quat | rotation | ) |
Sets the rotation of the physics object.
void tram::PhysicsComponent::SetShape | ( | Physics::CollisionShape | shape | ) |
Sets the collision shape of the physics object.
void tram::PhysicsComponent::SetUpdateParentTransform | ( | bool | update | ) |
Sets whether the movement of the rigibody should update parent Entity's transform.
If set to true, then whenever the rigidbody moves, the transform of the parent will be set to the transform of the rigidbody. Otherwise, the parent's transform will remain unaffected.
void tram::PhysicsComponent::SetVelocity | ( | const vec3 & | velocity | ) |
Sets the velocity of the physics object.
Only works if is component is loaded.
void tram::PhysicsComponent::Sleep | ( | ) |
Puts the object to sleep.
void tram::PhysicsComponent::Spin | ( | vec3 | direction | ) |
|
virtual |
Implements tram::EntityComponent.