SP3-2 Cleaned Up Physics System #85
|
@ -67,6 +67,19 @@ namespace SHADE
|
|||
XMStoreFloat4(this, XMQuaternionRotationMatrix(M));
|
||||
}
|
||||
|
||||
SHQuaternion::SHQuaternion(const reactphysics3d::Vector3& rp3dEuler) noexcept
|
||||
: XMFLOAT4( 0.0f, 0.0f, 0.0f, 1.0f )
|
||||
{
|
||||
const SHVec3& SHADE_VEC{ rp3dEuler };
|
||||
|
||||
const XMVECTOR V = XMLoadFloat3(&SHADE_VEC);
|
||||
XMStoreFloat4(this, XMQuaternionRotationRollPitchYawFromVector(V));
|
||||
}
|
||||
|
||||
SHQuaternion::SHQuaternion(const reactphysics3d::Quaternion& rp3dQuat) noexcept
|
||||
: XMFLOAT4( rp3dQuat.x, rp3dQuat.y, rp3dQuat.z, rp3dQuat.w )
|
||||
{}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -176,6 +189,11 @@ namespace SHADE
|
|||
return XMQuaternionNotEqual(Q1, Q2);
|
||||
}
|
||||
|
||||
SHQuaternion::operator reactphysics3d::Quaternion() const noexcept
|
||||
{
|
||||
return reactphysics3d::Quaternion{ x, y, z, w };
|
||||
}
|
||||
|
||||
SHQuaternion operator*(float lhs, const SHQuaternion& rhs) noexcept
|
||||
{
|
||||
return rhs * lhs;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <reactphysics3d/mathematics/Quaternion.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
// Project Headers
|
||||
|
@ -46,12 +48,17 @@ namespace SHADE
|
|||
SHQuaternion (const SHQuaternion& rhs) = default;
|
||||
SHQuaternion (SHQuaternion&& rhs) = default;
|
||||
|
||||
SHQuaternion () noexcept;
|
||||
SHQuaternion (float x, float y, float z, float w) noexcept;
|
||||
SHQuaternion (float yaw, float pitch, float roll) noexcept;
|
||||
SHQuaternion (const SHVec3& eulerAngles) noexcept;
|
||||
SHQuaternion (const SHVec3& axis, float angleInRad) noexcept;
|
||||
SHQuaternion (const SHMatrix& rotationMatrix) noexcept;
|
||||
SHQuaternion () noexcept;
|
||||
SHQuaternion (float x, float y, float z, float w) noexcept;
|
||||
SHQuaternion (float yaw, float pitch, float roll) noexcept;
|
||||
SHQuaternion (const SHVec3& eulerAngles) noexcept;
|
||||
SHQuaternion (const SHVec3& axis, float angleInRad) noexcept;
|
||||
SHQuaternion (const SHMatrix& rotationMatrix) noexcept;
|
||||
|
||||
// Conversion from other math types
|
||||
|
||||
SHQuaternion (const reactphysics3d::Vector3& rp3dEuler) noexcept;
|
||||
SHQuaternion (const reactphysics3d::Quaternion& rp3dQuat) noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
|
@ -76,6 +83,10 @@ namespace SHADE
|
|||
[[nodiscard]] bool operator== (const SHQuaternion& rhs) const noexcept;
|
||||
[[nodiscard]] bool operator!= (const SHQuaternion& rhs) const noexcept;
|
||||
|
||||
// Conversion to other math types used by SHADE
|
||||
|
||||
operator reactphysics3d::Quaternion () const noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Getter Functions */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -46,6 +46,10 @@ namespace SHADE
|
|||
: XMFLOAT2( _x, _y )
|
||||
{}
|
||||
|
||||
SHVec2::SHVec2(const reactphysics3d::Vector2& rp3dVec2) noexcept
|
||||
: XMFLOAT2( rp3dVec2.x, rp3dVec2.y )
|
||||
{}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -213,6 +217,11 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
SHVec2::operator reactphysics3d::Vector2() const noexcept
|
||||
{
|
||||
return reactphysics3d::Vector2{ x, y };
|
||||
}
|
||||
|
||||
SHVec2 operator* (float lhs, const SHVec2& rhs) noexcept
|
||||
{
|
||||
SHVec2 result;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <reactphysics3d/mathematics/Vector2.h>
|
||||
|
||||
#include <string>
|
||||
#include <initializer_list>
|
||||
|
||||
|
@ -52,9 +54,13 @@ namespace SHADE
|
|||
SHVec2 (SHVec2&& rhs) = default;
|
||||
~SHVec2 () = default;
|
||||
|
||||
SHVec2 () noexcept;
|
||||
SHVec2 (float n) noexcept;
|
||||
SHVec2 (float x, float y) noexcept;
|
||||
SHVec2 () noexcept;
|
||||
SHVec2 (float n) noexcept;
|
||||
SHVec2 (float x, float y) noexcept;
|
||||
|
||||
// Conversion from other math types to SHADE
|
||||
|
||||
SHVec2 (const reactphysics3d::Vector2& rp3dVec2) noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
|
@ -86,6 +92,10 @@ namespace SHADE
|
|||
[[nodiscard]] float operator[] (int index) const;
|
||||
[[nodiscard]] float operator[] (size_t index) const;
|
||||
|
||||
// Conversion to other math types used by SHADE
|
||||
|
||||
operator reactphysics3d::Vector2 () const noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Function Members */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -51,6 +51,10 @@ namespace SHADE
|
|||
: XMFLOAT3( _x, _y, _z )
|
||||
{}
|
||||
|
||||
SHVec3::SHVec3(const reactphysics3d::Vector3& rp3dVec3) noexcept
|
||||
: XMFLOAT3( rp3dVec3.x, rp3dVec3.y, rp3dVec3.z )
|
||||
{}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Operator Overload Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -223,6 +227,16 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
SHVec3::operator reactphysics3d::Vector3() const noexcept
|
||||
{
|
||||
return reactphysics3d::Vector3{ x, y , z };
|
||||
}
|
||||
|
||||
SHVec3::operator reactphysics3d::Quaternion() const noexcept
|
||||
{
|
||||
return reactphysics3d::Quaternion::fromEulerAngles(x, y, z);
|
||||
}
|
||||
|
||||
SHVec3 operator* (float lhs, const SHVec3& rhs) noexcept
|
||||
{
|
||||
SHVec3 result;
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <DirectXMath.h>
|
||||
#include <reactphysics3d/mathematics/Vector3.h>
|
||||
#include <reactphysics3d/mathematics/Quaternion.h>
|
||||
|
||||
#include <string>
|
||||
#include <initializer_list>
|
||||
|
||||
|
@ -57,40 +60,48 @@ namespace SHADE
|
|||
SHVec3 (SHVec3&& rhs) = default;
|
||||
~SHVec3 () = default;
|
||||
|
||||
SHVec3 () noexcept;
|
||||
SHVec3 (float n) noexcept;
|
||||
SHVec3 (float x, float y, float z) noexcept;
|
||||
SHVec3 () noexcept;
|
||||
SHVec3 (float n) noexcept;
|
||||
SHVec3 (float x, float y, float z) noexcept;
|
||||
|
||||
// Conversion from other math types to SHADE
|
||||
|
||||
SHVec3 (const reactphysics3d::Vector3& rp3dVec3) noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Operator Overloads */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
SHVec3& operator= (const SHVec3& rhs) = default;
|
||||
SHVec3& operator= (SHVec3&& rhs) = default;
|
||||
SHVec3& operator= (const SHVec3& rhs) = default;
|
||||
SHVec3& operator= (SHVec3&& rhs) = default;
|
||||
|
||||
SHVec3& operator+= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator-= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator*= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator*= (float rhs) noexcept;
|
||||
SHVec3& operator/= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator/= (float rhs) noexcept;
|
||||
SHVec3& operator+= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator-= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator*= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator*= (float rhs) noexcept;
|
||||
SHVec3& operator/= (const SHVec3& rhs) noexcept;
|
||||
SHVec3& operator/= (float rhs) noexcept;
|
||||
|
||||
[[nodiscard]] SHVec3 operator+ (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator- (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator- () const noexcept;
|
||||
[[nodiscard]] SHVec3 operator* (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator* (float rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator/ (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator/ (float rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator+ (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator- (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator- () const noexcept;
|
||||
[[nodiscard]] SHVec3 operator* (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator* (float rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator/ (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] SHVec3 operator/ (float rhs) const noexcept;
|
||||
|
||||
[[nodiscard]] bool operator== (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] bool operator!= (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] bool operator== (const SHVec3& rhs) const noexcept;
|
||||
[[nodiscard]] bool operator!= (const SHVec3& rhs) const noexcept;
|
||||
|
||||
[[nodiscard]] float& operator[] (int index);
|
||||
[[nodiscard]] float& operator[] (size_t index);
|
||||
[[nodiscard]] float operator[] (int index) const;
|
||||
[[nodiscard]] float operator[] (size_t index) const;
|
||||
[[nodiscard]] float& operator[] (int index);
|
||||
[[nodiscard]] float& operator[] (size_t index);
|
||||
[[nodiscard]] float operator[] (int index) const;
|
||||
[[nodiscard]] float operator[] (size_t index) const;
|
||||
|
||||
// Conversion to other math types used by SHADE
|
||||
|
||||
operator reactphysics3d::Vector3 () const noexcept;
|
||||
operator reactphysics3d::Quaternion () const noexcept;
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Function Members */
|
||||
|
|
|
@ -44,10 +44,7 @@ namespace SHADE
|
|||
SHVec3 result;
|
||||
|
||||
if (rp3dBody)
|
||||
{
|
||||
const auto& RP3D_RESULT = rp3dBody->getTransform().getPosition();
|
||||
result = SHVec3{ RP3D_RESULT.x, RP3D_RESULT.y, RP3D_RESULT.z };
|
||||
}
|
||||
result = SHVec3{ rp3dBody->getTransform().getPosition() };
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -57,10 +54,7 @@ namespace SHADE
|
|||
SHQuaternion result;
|
||||
|
||||
if (rp3dBody)
|
||||
{
|
||||
const auto& RP3D_RESULT = rp3dBody->getTransform().getOrientation();
|
||||
result = SHQuaternion{ RP3D_RESULT.x, RP3D_RESULT.y, RP3D_RESULT.z, RP3D_RESULT.w };
|
||||
}
|
||||
result = SHQuaternion{ rp3dBody->getTransform().getOrientation() };
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -70,10 +64,7 @@ namespace SHADE
|
|||
SHVec3 result;
|
||||
|
||||
if (rp3dBody)
|
||||
{
|
||||
const auto& RP3D_RESULT = rp3dBody->getTransform().getOrientation();
|
||||
result = SHQuaternion{ RP3D_RESULT.x, RP3D_RESULT.y, RP3D_RESULT.z, RP3D_RESULT.w }.ToEuler();
|
||||
}
|
||||
result = SHQuaternion{ rp3dBody->getTransform().getOrientation() }.ToEuler();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -84,10 +75,8 @@ namespace SHADE
|
|||
|
||||
void SHPhysicsObject::SetPosition(const SHVec3& position) noexcept
|
||||
{
|
||||
const rp3d::Vector3 RP3D_POS { position.x, position.y, position.z };
|
||||
|
||||
rp3d::Transform rp3dTF;
|
||||
rp3dTF.setPosition(RP3D_POS);
|
||||
rp3dTF.setPosition(position);
|
||||
rp3dTF.setOrientation(rp3dBody->getTransform().getOrientation());
|
||||
|
||||
rp3dBody->setTransform(rp3dTF);
|
||||
|
@ -96,11 +85,9 @@ namespace SHADE
|
|||
|
||||
void SHPhysicsObject::SetOrientation(const SHQuaternion& orientation) noexcept
|
||||
{
|
||||
const rp3d::Quaternion RP3D_ORIENTATION { orientation.x, orientation.y, orientation.z, orientation.w };
|
||||
|
||||
rp3d::Transform rp3dTF;
|
||||
rp3dTF.setPosition(rp3dBody->getTransform().getPosition());
|
||||
rp3dTF.setOrientation(RP3D_ORIENTATION);
|
||||
rp3dTF.setOrientation(orientation);
|
||||
|
||||
rp3dBody->setTransform(rp3dTF);
|
||||
prevTransform = rp3dTF;
|
||||
|
|
|
@ -82,8 +82,5 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Function Members */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
};
|
||||
} // namespace SHADE
|
|
@ -68,10 +68,7 @@ namespace SHADE
|
|||
|
||||
if (world)
|
||||
{
|
||||
const auto RP3D_GRAVITY = world->getGravity();
|
||||
result.x = RP3D_GRAVITY.x;
|
||||
result.y = RP3D_GRAVITY.y;
|
||||
result.z = RP3D_GRAVITY.z;
|
||||
result = world->getGravity();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -112,8 +109,7 @@ namespace SHADE
|
|||
{
|
||||
if (world)
|
||||
{
|
||||
const rp3d::Vector3 G { gravity.x, gravity.y, gravity.z };
|
||||
world->setGravity(G);
|
||||
world->setGravity(gravity);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -161,8 +157,7 @@ namespace SHADE
|
|||
{
|
||||
if (world)
|
||||
{
|
||||
const rp3d::Vector3 G { settings.gravity.x, settings.gravity.y, settings.gravity.z };
|
||||
world->setGravity(G);
|
||||
world->setGravity(settings.gravity);
|
||||
world->setNbIterationsVelocitySolver(settings.numVelocitySolverIterations);
|
||||
world->setNbIterationsPositionSolver(settings.numPositionSolverIterations);
|
||||
world->enableSleeping(settings.sleepingEnabled);
|
||||
|
@ -225,13 +220,7 @@ namespace SHADE
|
|||
SHADE_TF = SHComponentManager::GetComponent<SHTransformComponent>(entityID);
|
||||
}
|
||||
|
||||
const SHVec3& SHADE_POS = SHADE_TF->GetWorldPosition();
|
||||
const SHVec3& SHADE_ROT = SHADE_TF->GetWorldRotation();
|
||||
|
||||
const rp3d::Vector3 RP3D_POS { SHADE_POS.x, SHADE_POS.y, SHADE_POS.z };
|
||||
const rp3d::Quaternion RP3D_ROT = rp3d::Quaternion::fromEulerAngles( SHADE_ROT.x, SHADE_ROT.y, SHADE_ROT.z );
|
||||
|
||||
const rp3d::Transform RP3D_TF { RP3D_POS, RP3D_ROT };
|
||||
const rp3d::Transform RP3D_TF { SHADE_TF->GetWorldPosition(), SHADE_TF->GetWorldRotation() };
|
||||
|
||||
// If collider already exists
|
||||
if (physicsObject->hasColliders)
|
||||
|
@ -251,10 +240,7 @@ namespace SHADE
|
|||
case SHCollider::Type::BOX:
|
||||
{
|
||||
SHBoundingBox* box = reinterpret_cast<SHBoundingBox*>(collider.GetShape());
|
||||
const SHVec3& SHADE_EXTENTS = box->GetHalfExtents();
|
||||
|
||||
rp3d::Vector3 RP3D_EXTENTS { SHADE_EXTENTS.x, SHADE_EXTENTS.y, SHADE_EXTENTS.z };
|
||||
rp3d::BoxShape* newBox = factory.createBoxShape(RP3D_EXTENTS);
|
||||
rp3d::BoxShape* newBox = factory.createBoxShape(box->GetHalfExtents());
|
||||
|
||||
// TODO(Diren): Handle offsets
|
||||
physicsObject->rp3dBody->addCollider(newBox, RP3D_TF);
|
||||
|
@ -296,13 +282,7 @@ namespace SHADE
|
|||
SHADE_TF = SHComponentManager::GetComponent<SHTransformComponent>(entityID);
|
||||
}
|
||||
|
||||
const SHVec3& SHADE_POS = SHADE_TF->GetWorldPosition();
|
||||
const SHVec3& SHADE_ROT = SHADE_TF->GetWorldRotation();
|
||||
|
||||
const rp3d::Vector3 RP3D_POS { SHADE_POS.x, SHADE_POS.y, SHADE_POS.z };
|
||||
const rp3d::Quaternion RP3D_ROT = rp3d::Quaternion::fromEulerAngles( SHADE_ROT.x, SHADE_ROT.y, SHADE_ROT.z );
|
||||
|
||||
const rp3d::Transform RP3D_TF { RP3D_POS, RP3D_ROT };
|
||||
const rp3d::Transform RP3D_TF { SHADE_TF->GetWorldPosition(), SHADE_TF->GetWorldRotation() };
|
||||
|
||||
// No rb
|
||||
if (!physicsObject->isRigidBody)
|
||||
|
@ -316,10 +296,7 @@ namespace SHADE
|
|||
case SHCollider::Type::BOX:
|
||||
{
|
||||
SHBoundingBox* box = reinterpret_cast<SHBoundingBox*>(collider.GetShape());
|
||||
const SHVec3& SHADE_EXTENTS = box->GetHalfExtents();
|
||||
|
||||
rp3d::Vector3 RP3D_EXTENTS { SHADE_EXTENTS.x, SHADE_EXTENTS.y, SHADE_EXTENTS.z };
|
||||
rp3d::BoxShape* newBox = factory.createBoxShape(RP3D_EXTENTS);
|
||||
rp3d::BoxShape* newBox = factory.createBoxShape(box->GetHalfExtents());
|
||||
|
||||
// TODO(Diren): Handle offsets
|
||||
physicsObject->rp3dBody->addCollider(newBox, RP3D_TF);
|
||||
|
@ -401,10 +378,7 @@ namespace SHADE
|
|||
case SHShape::Type::BOUNDING_BOX:
|
||||
{
|
||||
auto* box = reinterpret_cast<SHBoundingBox*>(shape);
|
||||
const SHVec3& SHADE_EXTENTS = box->GetHalfExtents();
|
||||
|
||||
rp3d::Vector3 RP3D_EXTENTS { SHADE_EXTENTS.x, SHADE_EXTENTS.y, SHADE_EXTENTS.z };
|
||||
rp3d::BoxShape* newBox = factory.createBoxShape(RP3D_EXTENTS);
|
||||
rp3d::BoxShape* newBox = factory.createBoxShape(box->GetHalfExtents());
|
||||
|
||||
// TODO(Diren): Handle offsets
|
||||
|
||||
|
@ -593,12 +567,9 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// Convert RP3D Transform to SHADE
|
||||
const SHVec3 SHADE_POS = SHVec3{ rp3dPos.x, rp3dPos.y, rp3dPos.z };
|
||||
const SHVec3 SHADE_ROT = SHQuaternion{ rp3dRot.x, rp3dRot.y, rp3dRot.z, rp3dRot.w }.ToEuler();
|
||||
|
||||
auto* tfComponent = SHComponentManager::GetComponent<SHTransformComponent>(ENTITY_ID);
|
||||
tfComponent->SetWorldPosition(SHADE_POS);
|
||||
tfComponent->SetWorldRotation(SHADE_ROT);
|
||||
tfComponent->SetWorldPosition(rp3dPos);
|
||||
tfComponent->SetWorldRotation(SHQuaternion{ rp3dRot }.ToEuler());
|
||||
|
||||
// Cache transforms
|
||||
physicsObject.prevTransform = CURRENT_TF;
|
||||
|
@ -660,18 +631,12 @@ namespace SHADE
|
|||
}
|
||||
case 8: // Linear Velocity
|
||||
{
|
||||
const SHVec3& SHADE_VEL = comp->GetLinearVelocity();
|
||||
rp3d::Vector3 RP3D_VEL { SHADE_VEL.x, SHADE_VEL.y, SHADE_VEL.z };
|
||||
|
||||
rigidBody->setLinearVelocity(RP3D_VEL);
|
||||
rigidBody->setLinearVelocity(comp->GetLinearVelocity());
|
||||
break;
|
||||
}
|
||||
case 9: // Angular Velocity
|
||||
{
|
||||
const SHVec3& SHADE_VEL = comp->GetAngularVelocity();
|
||||
rp3d::Vector3 RP3D_VEL { SHADE_VEL.x, SHADE_VEL.y, SHADE_VEL.z };
|
||||
|
||||
rigidBody->setAngularVelocity(RP3D_VEL);
|
||||
rigidBody->setAngularVelocity(comp->GetAngularVelocity());
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
@ -718,12 +683,9 @@ namespace SHADE
|
|||
case SHCollider::Type::BOX:
|
||||
{
|
||||
SHBoundingBox* box = reinterpret_cast<SHBoundingBox*>(collider.GetShape());
|
||||
const SHVec3& SHADE_EXTENTS = box->GetHalfExtents();
|
||||
|
||||
rp3d::Vector3 RP3D_EXTENTS { SHADE_EXTENTS.x, SHADE_EXTENTS.y, SHADE_EXTENTS.z };
|
||||
|
||||
auto* rp3dBoxShape = reinterpret_cast<rp3d::BoxShape*>(physicsObject->rp3dBody->getCollider(index)->getCollisionShape());
|
||||
rp3dBoxShape->setHalfExtents(RP3D_EXTENTS);
|
||||
rp3dBoxShape->setHalfExtents(box->GetHalfExtents());
|
||||
|
||||
if (rp3dBoxShape)
|
||||
{
|
||||
|
|
|
@ -185,18 +185,18 @@ namespace SHADE
|
|||
/*---------------------------------------------------------------------------------*/
|
||||
/* Function Members */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
SHPhysicsObject* GetPhysicsObject (EntityID entityID) noexcept;
|
||||
SHPhysicsObject* GetPhysicsObject (EntityID entityID) noexcept;
|
||||
|
||||
void SyncRigidBodyComponents (std::vector<SHRigidBodyComponent>& denseArray) noexcept;
|
||||
void SyncColliderComponents (std::vector<SHColliderComponent>& denseArray) noexcept;
|
||||
void SyncTransforms () noexcept;
|
||||
void SyncRigidBodyComponents (std::vector<SHRigidBodyComponent>& denseArray) noexcept;
|
||||
void SyncColliderComponents (std::vector<SHColliderComponent>& denseArray) noexcept;
|
||||
void SyncTransforms () noexcept;
|
||||
// TODO(Diren): Trigger handling
|
||||
|
||||
static void SyncRigidBody (SHPhysicsObject const* physicsObject, const SHRigidBodyComponent* comp) noexcept;
|
||||
static void SetRP3DLinearConstraints (rp3d::RigidBody const* rp3dRigidBody, uint8_t rbFlags) noexcept;
|
||||
static void SetRP3DAngularConstraints (rp3d::RigidBody const* rp3dRigidBody, uint8_t rbFlags) noexcept;
|
||||
static void SetRP3DLinearConstraints (rp3d::RigidBody const* rp3dRigidBody, uint8_t rbFlags) noexcept;
|
||||
static void SetRP3DAngularConstraints (rp3d::RigidBody const* rp3dRigidBody, uint8_t rbFlags) noexcept;
|
||||
|
||||
static void SyncCollider (SHPhysicsObject const* physicsObject, SHColliderComponent* comp) noexcept;
|
||||
static void SyncCollider (SHPhysicsObject const* physicsObject, SHColliderComponent* comp) noexcept;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ project "SHADE_Managed"
|
|||
"%{IncludeDir.yamlcpp}",
|
||||
"%{IncludeDir.RTTR}/include",
|
||||
"%{IncludeDir.dotnet}\\include",
|
||||
"%{IncludeDir.reactphysics3d}\\include",
|
||||
"%{wks.location}/SHADE_Engine/src"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue