Bug fixes and scene changes #267
|
@ -178,14 +178,23 @@ namespace SHADE
|
||||||
/* Public Function Member Definitions */
|
/* Public Function Member Definitions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
bool SHBox::TestPoint(const SHVec3& point) noexcept
|
bool SHBox::TestPoint(const SHVec3& point) const noexcept
|
||||||
{
|
{
|
||||||
return BoundingBox::Contains(point);
|
return BoundingBox::Contains(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHBox::Raycast(const SHRay& ray, float& distance) noexcept
|
SHRaycastResult SHBox::Raycast(const SHRay& ray) const noexcept
|
||||||
{
|
{
|
||||||
return BoundingBox::Intersects(ray.position, ray.direction, distance);
|
SHRaycastResult result;
|
||||||
|
|
||||||
|
result.hit = Intersects(ray.position, ray.direction, result.distance);
|
||||||
|
if (result.hit)
|
||||||
|
{
|
||||||
|
result.position = ray.position + ray.direction * result.distance;
|
||||||
|
result.angle = SHVec3::Angle(ray.position, result.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHBox::Contains(const SHBox& rhs) const noexcept
|
bool SHBox::Contains(const SHBox& rhs) const noexcept
|
||||||
|
|
|
@ -76,8 +76,8 @@ namespace SHADE
|
||||||
/* Function Members */
|
/* Function Members */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
[[nodiscard]] bool TestPoint (const SHVec3& point) noexcept override;
|
[[nodiscard]] bool TestPoint (const SHVec3& point) const noexcept override;
|
||||||
[[nodiscard]] bool Raycast (const SHRay& ray, float& distance) noexcept override;
|
[[nodiscard]] SHRaycastResult Raycast(const SHRay& ray) const noexcept override;
|
||||||
|
|
||||||
[[nodiscard]] bool Contains (const SHBox& rhs) const noexcept;
|
[[nodiscard]] bool Contains (const SHBox& rhs) const noexcept;
|
||||||
[[nodiscard]] float Volume () const noexcept;
|
[[nodiscard]] float Volume () const noexcept;
|
||||||
|
|
|
@ -69,8 +69,8 @@ namespace SHADE
|
||||||
/* Function Members */
|
/* Function Members */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
[[nodiscard]] virtual bool TestPoint (const SHVec3& point) noexcept = 0;
|
[[nodiscard]] virtual bool TestPoint (const SHVec3& point) const noexcept = 0;
|
||||||
[[nodiscard]] virtual bool Raycast (const SHRay& ray, float& distance) noexcept = 0;
|
[[nodiscard]] virtual SHRaycastResult Raycast (const SHRay& ray) const noexcept = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -138,14 +138,23 @@ namespace SHADE
|
||||||
/* Public Function Member Definitions */
|
/* Public Function Member Definitions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
bool SHSphere::TestPoint(const SHVec3& point) noexcept
|
bool SHSphere::TestPoint(const SHVec3& point) const noexcept
|
||||||
{
|
{
|
||||||
return BoundingSphere::Contains(point);
|
return BoundingSphere::Contains(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHSphere::Raycast(const SHRay& ray, float& distance) noexcept
|
SHRaycastResult SHSphere::Raycast(const SHRay& ray) const noexcept
|
||||||
{
|
{
|
||||||
return Intersects(ray.position, ray.direction, distance);
|
SHRaycastResult result;
|
||||||
|
|
||||||
|
result.hit = Intersects(ray.position, ray.direction, result.distance);
|
||||||
|
if (result.hit)
|
||||||
|
{
|
||||||
|
result.position = ray.position + ray.direction * result.distance;
|
||||||
|
result.angle = SHVec3::Angle(ray.position, result.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHSphere::Contains(const SHSphere& rhs) const noexcept
|
bool SHSphere::Contains(const SHSphere& rhs) const noexcept
|
||||||
|
|
|
@ -64,12 +64,12 @@ namespace SHADE
|
||||||
/* Function Members */
|
/* Function Members */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
[[nodiscard]] bool TestPoint (const SHVec3& point) noexcept override;
|
[[nodiscard]] bool TestPoint (const SHVec3& point) const noexcept override;
|
||||||
[[nodiscard]] bool Raycast (const SHRay& ray, float& distance) noexcept override;
|
[[nodiscard]] SHRaycastResult Raycast(const SHRay& ray) const noexcept override;
|
||||||
|
|
||||||
[[nodiscard]] bool Contains (const SHSphere& rhs) const noexcept;
|
[[nodiscard]] bool Contains (const SHSphere& rhs) const noexcept;
|
||||||
[[nodiscard]] float Volume () const noexcept;
|
[[nodiscard]] float Volume () const noexcept;
|
||||||
[[nodiscard]] float SurfaceArea () const noexcept;
|
[[nodiscard]] float SurfaceArea () const noexcept;
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -265,11 +265,11 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int NUM_SHAPES = static_cast<int>(componentGroup.colliderComponent->GetCollisionShapes().size());
|
//const int NUM_SHAPES = static_cast<int>(componentGroup.colliderComponent->GetCollisionShapes().size());
|
||||||
for (int i = 0; i < NUM_SHAPES; ++i)
|
//for (int i = 0; i < NUM_SHAPES; ++i)
|
||||||
physicsObject->AddCollisionShape(i);
|
// physicsObject->AddCollisionShape(i);
|
||||||
|
|
||||||
physicsObject->SyncColliders(*componentGroup.colliderComponent);
|
//physicsObject->SyncColliders(*componentGroup.colliderComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHPhysicsObjectManager::removeRigidBody(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
void SHPhysicsObjectManager::removeRigidBody(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
bool BoxCollider::Raycast(Ray ray, float maxDistance)
|
bool BoxCollider::Raycast(Ray ray, float maxDistance)
|
||||||
{
|
{
|
||||||
return getNativeCollisionShape<SHBox>().Raycast(Convert::ToNative(ray), maxDistance);
|
return getNativeCollisionShape<SHBox>().Raycast(Convert::ToNative(ray));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
@ -200,7 +200,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
bool SphereCollider::Raycast(Ray ray, float maxDistance)
|
bool SphereCollider::Raycast(Ray ray, float maxDistance)
|
||||||
{
|
{
|
||||||
return getNativeCollisionShape<SHBox>().Raycast(Convert::ToNative(ray), maxDistance);
|
return getNativeCollisionShape<SHBox>().Raycast(Convert::ToNative(ray));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue