Refactor Physics to separate PhysicsBackend

#673
This commit is contained in:
Wojtek Figat
2022-01-20 23:28:43 +01:00
parent cf1af53ab8
commit 427846f73b
66 changed files with 4803 additions and 4327 deletions

View File

@@ -2,8 +2,6 @@
#include "SphereCollider.h"
#include "Engine/Serialization/Serialization.h"
#include "Engine/Physics/Utilities.h"
#include <PxShape.h>
SphereCollider::SphereCollider(const SpawnParams& params)
: Collider(params)
@@ -78,11 +76,10 @@ void SphereCollider::UpdateBounds()
_sphere.GetBoundingBox(_box);
}
void SphereCollider::GetGeometry(PxGeometryHolder& geometry)
void SphereCollider::GetGeometry(CollisionShape& collision)
{
const float scaling = _cachedScale.GetAbsolute().MaxValue();
const float radius = Math::Abs(_radius) * scaling;
const float minSize = 0.001f;
const PxSphereGeometry sphere(Math::Max(radius, minSize));
geometry.storeAny(sphere);
collision.SetSphere(Math::Max(radius, minSize));
}