A special object class that represents the physics body that responds to the world and collisions using a specified shape, should be used by adding to VPhysicsGroup.
More...
#include <VPhysicsObject.h>
|
| enum | VObjectShape { CIRCLE,
BOX,
LINE,
CUSTOM
} |
| | The shape of the collision area of the physics object.
|
| |
| enum | VObjectType { DYNAMIC,
KINEMATIC,
STATIC
} |
| | The physics type of the physics object.
|
| |
|
typedef VBase | VSUPERCLASS |
| | Used to call parent class functions when they are overrided in class.
|
| |
|
| static const wchar_t * | VString (const char *fmt,...) |
| |
| static void | VLog (const char *fmt,...) |
| |
| static void | VLogError (const char *fmt,...) |
| |
| static void | VClearLog () |
| |
|
bool | active = true |
| | Base can be updated using Update if true.
|
| |
|
bool | visible = true |
| | Base can be rendered using Draw if true.
|
| |
|
bool | alive = true |
| | Helper member that is mainly used filter out behaviours to objects which aren't alive in the scene.
|
| |
|
bool | exists = true |
| | Base can be updated and rendered if true, else it would no longer be treated as being part of the scene.
|
| |
|
VType | type = NONE |
| | Base object type, typically set in the constructor of an inherited object to specify what type it is.
|
| |
|
uint32_t | RefCount = 0 |
| | Counts the amount of times the object is referenced in groups, ensures an object is only destroyed when no longer part of a single group.
|
| |
A special object class that represents the physics body that responds to the world and collisions using a specified shape, should be used by adding to VPhysicsGroup.
◆ VPhysicsObject()
| VPhysicsObject::VPhysicsObject |
( |
VObject * |
Object, |
|
|
VObjectType |
BodyType, |
|
|
VObjectShape |
Shape = VObjectShape::BOX, |
|
|
std::vector< sf::Vector2f > |
Verts = {} |
|
) |
| |
- Parameters
-
| Object | The game object to apply physics towards. |
| BodyType | The type of physics body to set the physics object to. |
| Shape | The type of collision shape the object will have. Default is BOX. |
| Verts | If the shape set is LINE or CUSTOM, this parameter will define the shape in local space (relative to the top-left of the game object). |
◆ ApplyForceAtLocalPoint()
| void VPhysicsObject::ApplyForceAtLocalPoint |
( |
sf::Vector2f |
force, |
|
|
sf::Vector2f |
point |
|
) |
| |
Applys a force towards the phyics body at a point in local space.
- Parameters
-
| force | The force to apply. |
| point | The point in local space to apply the force to. |
◆ ApplyForceAtWorldPoint()
| void VPhysicsObject::ApplyForceAtWorldPoint |
( |
sf::Vector2f |
force, |
|
|
sf::Vector2f |
point |
|
) |
| |
Applys a force towards the phyics body at a point in world space.
- Parameters
-
| force | The force to apply. |
| point | The point in world space to apply the force to. |
◆ ApplyImpulseAtLocalPoint()
| void VPhysicsObject::ApplyImpulseAtLocalPoint |
( |
sf::Vector2f |
impulse, |
|
|
sf::Vector2f |
point |
|
) |
| |
Applys an impulse towards the phyics body at a point in local space.
- Parameters
-
| impulse | The impulse to apply. |
| point | The point in local space to apply the force to. |
◆ ApplyImpulseAtWorldPoint()
| void VPhysicsObject::ApplyImpulseAtWorldPoint |
( |
sf::Vector2f |
impulse, |
|
|
sf::Vector2f |
point |
|
) |
| |
Applys an impluse towards the phyics body at a point in world space.
- Parameters
-
| impulse | The impulse to apply. |
| point | The point in world space to apply the force to. |
◆ Deinitialise()
Deinitises and removes the physics object from the world.
- Parameters
-
| space | The physics space to remove the object from. |
◆ GetBaseObject()
| VObject* VPhysicsObject::GetBaseObject |
( |
| ) |
|
- Returns
- Gets the base game object that physics is being applied to.
◆ GetBody()
- Returns
- Gets the physics body as a void pointer (so it can be cast to a cpBody if necessary).
◆ GetBodyType()
- Returns
- The tyoe of physics body of the physics object.
◆ GetDensity()
| float VPhysicsObject::GetDensity |
( |
| ) |
|
- Returns
- The density of the physics shape.
◆ GetForce()
| sf::Vector2f VPhysicsObject::GetForce |
( |
| ) |
|
- Returns
- The force of the physics body.
◆ GetFriction()
| float VPhysicsObject::GetFriction |
( |
| ) |
|
- Returns
- The friction of the physics shape.
◆ GetShape()
- Returns
- Gets the physics shape as a void pointer (so it can be cast to a cpShape if necessary).
◆ GetShapeType()
- Returns
- The type of shape of the physics object.
◆ GetSurfaceVelocity()
| sf::Vector2f VPhysicsObject::GetSurfaceVelocity |
( |
| ) |
|
- Returns
- The surface velocity of the physics shape.
◆ GetTorque()
| float VPhysicsObject::GetTorque |
( |
| ) |
|
- Returns
- The torque of the physics body.
◆ Initialise()
Initialises the physics object.
- Parameters
-
| space | The physics space to initialise the object to. |
◆ SetBodyType()
| void VPhysicsObject::SetBodyType |
( |
VObjectType |
bodyType | ) |
|
Set the physics body of the object.
- Parameters
-
| bodyType | The new phyiscs body type. |
◆ SetDensity()
| void VPhysicsObject::SetDensity |
( |
float |
density | ) |
|
Sets the shape density.
- Parameters
-
| density | The new density value of the physics shape. |
◆ SetForce()
| void VPhysicsObject::SetForce |
( |
sf::Vector2f |
force | ) |
|
Sets the force of the physics body.
- Parameters
-
| force | The new force value of the physics body. |
◆ SetFriction()
| void VPhysicsObject::SetFriction |
( |
float |
friction | ) |
|
Sets the shape friction.
- Parameters
-
| friction | The new friction value of the physics shape. |
◆ SetSurfaceVelocity()
| void VPhysicsObject::SetSurfaceVelocity |
( |
sf::Vector2f |
surfaceVelocity | ) |
|
Sets the surface velocity of the physics shape.
- Parameters
-
| surfaceVelocity | The new surface velocity of the physics shape. |
◆ SetTorque()
| void VPhysicsObject::SetTorque |
( |
float |
torque | ) |
|
Sets the torque of the physics body.
- Parameters
-
| torque | The new torque of the physics body. |
◆ Update()
| virtual void VPhysicsObject::Update |
( |
float |
dt | ) |
|
|
overridevirtual |
Updates the physics object.
- Parameters
-
| dt | The delta time between the previous and current frame. |
Reimplemented from VBase.
The documentation for this class was generated from the following file: