6 #include <reactphysics3d/collision/shapes/BoxShape.h>
25 const array<int32_t, 3> OrientedBoundingBox::FACE0_INDICES = {{ 0, 4, 7 }};
26 const array<int32_t, 3> OrientedBoundingBox::FACE1_INDICES = {{ 7, 3, 0 }};
27 const array<int32_t, 3> OrientedBoundingBox::FACE2_INDICES = {{ 6, 5, 1 }};
28 const array<int32_t, 3> OrientedBoundingBox::FACE3_INDICES = {{ 1, 2, 6 }};
29 const array<int32_t, 3> OrientedBoundingBox::FACE4_INDICES = {{ 5, 4, 0 }};
30 const array<int32_t, 3> OrientedBoundingBox::FACE5_INDICES = {{ 0, 1, 5 }};
31 const array<int32_t, 3> OrientedBoundingBox::FACE6_INDICES = {{ 3, 7, 6 }};
32 const array<int32_t, 3> OrientedBoundingBox::FACE7_INDICES = {{ 6, 2, 3 }};
33 const array<int32_t, 3> OrientedBoundingBox::FACE8_INDICES = {{ 2, 1, 0 }};
34 const array<int32_t, 3> OrientedBoundingBox::FACE9_INDICES = {{ 0, 3, 2 }};
35 const array<int32_t, 3> OrientedBoundingBox::FACE10_INDICES = {{ 4, 5, 6 }};
36 const array<int32_t, 3> OrientedBoundingBox::FACE11_INDICES = {{ 6, 7, 4 }};
37 const array<array<int32_t,3>,12> OrientedBoundingBox::facesVerticesIndexes =
39 FACE0_INDICES, FACE1_INDICES, FACE2_INDICES, FACE3_INDICES,
40 FACE4_INDICES, FACE5_INDICES, FACE6_INDICES, FACE7_INDICES,
41 FACE8_INDICES, FACE9_INDICES, FACE10_INDICES, FACE11_INDICES
44 const Vector3 OrientedBoundingBox::AABB_AXIS_X(1.0f, 0.0f, 0.0f);
45 const Vector3 OrientedBoundingBox::AABB_AXIS_Y(0.0f, 1.0f, 0.0f);
46 const Vector3 OrientedBoundingBox::AABB_AXIS_Z(0.0f, 0.0f, 1.0f);
51 this->
axes[0].set(axis0);
52 this->
axes[1].set(axis1);
53 this->
axes[2].set(axis2);
83 array<Vector3, 8> vertices;
84 array<Vector3, 3> xyzAxes;
91 vertices[0].
set(0.0f, 0.0f, 0.0f);
97 vertices[1].
set(0.0f, 0.0f, 0.0f);
103 vertices[2].
set(0.0f, 0.0f, 0.0f);
109 vertices[3].
set(0.0f, 0.0f, 0.0f);
115 vertices[4].
set(0.0f, 0.0f, 0.0f);
121 vertices[5].
set(0.0f, 0.0f, 0.0f);
127 vertices[6].
set(0.0f, 0.0f, 0.0f);
133 vertices[7].
set(0.0f, 0.0f, 0.0f);
166 reactphysics3d::Quaternion(
167 reactphysics3d::Matrix3x3(
168 this->
axes[0].getX(),
169 this->
axes[0].getY(),
170 this->
axes[0].getZ(),
171 this->
axes[1].getX(),
172 this->
axes[1].getY(),
173 this->
axes[1].getZ(),
174 this->
axes[2].getX(),
175 this->
axes[2].getY(),
190 if (this->world !=
nullptr && this->world !=
world) {
191 Console::println(
"OrientedBoundingBox::createCollisionShape(): already attached to a world.");
197 reactphysics3d::Vector3(
Dynamic physics world class.
reactphysics3d::PhysicsCommon physicsCommon
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
Bounding volume interface.
reactphysics3d::Transform collisionShapeLocalTransform
Vector3 collisionShapeLocalTranslation
reactphysics3d::CollisionShape * collisionShape
Oriented bounding box physics primitive.
const Vector3 & getHalfExtension() const
static STATIC_DLL_IMPEXT const array< array< int32_t, 3 >, 12 > facesVerticesIndexes
~OrientedBoundingBox()
Public destructor.
const array< Vector3, 8 > getVertices() const
void destroyCollisionShape() override
Destroy collision shape.
void setScale(const Vector3 &scale) override
Set up oriented bounding box from oriented bounding box.
OrientedBoundingBox()
Public constructor.
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_Y
static const array< array< int32_t, 3 >, 12 > & getFacesVerticesIndexes()
const array< Vector3, 3 > & getAxes() const
void createCollisionShape(World *world) override
Create collision shap.
BoundingVolume * clone() const override
Clones this bounding volume.
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_Z
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_X
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 & add(float scalar)
Adds a scalar.
Vector3 & sub(float scalar)
Subtracts a scalar.
Vector3 & scale(float scalar)
Scales by scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.