TDME2 1.9.121
BoundingVolume.cpp
Go to the documentation of this file.
2
3#include <string>
4
5#include <ext/reactphysics3d/src/body/CollisionBody.h>
6#include <ext/reactphysics3d/src/collision/narrowphase/DefaultCollisionDispatch.h>
7#include <ext/reactphysics3d/src/collision/narrowphase/NarrowPhaseAlgorithm.h>
8#include <ext/reactphysics3d/src/collision/shapes/CollisionShape.h>
9#include <ext/reactphysics3d/src/collision/CollisionCallback.h>
10#include <ext/reactphysics3d/src/collision/NarrowPhaseInfo.h>
11#include <ext/reactphysics3d/src/collision/ProxyShape.h>
12#include <ext/reactphysics3d/src/constraint/ContactPoint.h>
13#include <ext/reactphysics3d/src/engine/CollisionWorld.h>
14#include <ext/reactphysics3d/src/engine/OverlappingPair.h>
15#include <ext/reactphysics3d/src/mathematics/Transform.h>
16#include <ext/reactphysics3d/src/memory/MemoryAllocator.h>
17
18#include <tdme/tdme.h>
20#include <tdme/math/Vector3.h>
21
22using std::to_string;
23
28
29BoundingVolume::~BoundingVolume() {
30 if (collisionShape != nullptr) delete collisionShape;
31}
32
36 Vector3(collisionShapeAABB.getMin().x, collisionShapeAABB.getMin().y, collisionShapeAABB.getMin().z),
37 Vector3(collisionShapeAABB.getMax().x, collisionShapeAABB.getMax().y, collisionShapeAABB.getMax().z)
38 );
40}
41
43 //
44 setScale(transformations.getScale());
45
46 // set transform
47 collisionShapeTransform.setPosition(
48 reactphysics3d::Vector3(
49 transformations.getTranslation().getX(),
50 transformations.getTranslation().getY(),
51 transformations.getTranslation().getZ()
52 )
53 );
54 collisionShapeTransform.setOrientation(
55 reactphysics3d::Quaternion(
56 transformations.getRotationsQuaternion().getX(),
57 transformations.getRotationsQuaternion().getY(),
58 transformations.getRotationsQuaternion().getZ(),
59 transformations.getRotationsQuaternion().getW()
60 )
61 );
62
63 // compute bounding box
65}
66
68 return scale;
69}
70
72 return center;
73}
74
76 return centerTransformed;
77}
78
81}
Transformations which contain scale, rotations and translation.
const Quaternion & getRotationsQuaternion() const
const Vector3 & getScale() const
const Vector3 & getTranslation() const
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
Definition: BoundingBox.h:25
const Vector3 & getCenter() const
Definition: BoundingBox.h:120
virtual void setScale(const Vector3 &scale)=0
Set local scale.
reactphysics3d::Transform collisionShapeLocalTransform
const Vector3 & getCenterTransformed() const
reactphysics3d::Transform collisionShapeTransform
virtual void fromTransformations(const Transformations &transformations)
Transform bounding volume from given transformations.
reactphysics3d::CollisionShape * collisionShape
const Vector3 & getScale()
Get local scale.
void computeBoundingBox()
Compute bounding box.
BoundingBox & getBoundingBoxTransformed()
Get bounding box transformed.
float getY() const
Definition: Quaternion.h:119
float getX() const
Definition: Quaternion.h:102
float getZ() const
Definition: Quaternion.h:136
float getW() const
Definition: Quaternion.h:153
3D vector 3 class
Definition: Vector3.h:22
float getY() const
Definition: Vector3.h:119
float getX() const
Definition: Vector3.h:103
float getZ() const
Definition: Vector3.h:136