hx3d  1
2D/3D Simple Game Framework
mass.cpp
1 #include "hx3d/physics/2d/mass.hpp"
2 
3 namespace hx3d {
4 namespace physics2d {
5 
6 Mass::Mass() {
7  mass = 0;
8  invMass = 0;
9 
10  inertia = 0;
11  invInertia = 0;
12 }
13 
14 void Mass::setMass(float amount) {
15  mass = amount;
16  invMass = (amount == 0) ? 0 : 1.f / amount;
17 }
18 
19 void Mass::setInertia(float amount) {
20  inertia = amount;
21  invInertia = (amount == 0) ? 0 : 1.f / amount;
22 }
23 
24 } /* physics2d */
25 } /* hx3d */
float mass
Current mass.
Definition: mass.hpp:54
float invInertia
Current inverted inertia.
Definition: mass.hpp:61
hx3d framework namespace
Definition: audio.hpp:26
float inertia
Current inertia.
Definition: mass.hpp:59
void setInertia(float amount)
Set the current inertia.
Definition: mass.cpp:19
void setMass(float amount)
Set the current mass.
Definition: mass.cpp:14
float invMass
Current inverted mass.
Definition: mass.hpp:56