Added Physics.Raycast and Transform shortcut on entity objects

This commit is contained in:
Antoine Pilote
2024-09-04 22:26:59 -04:00
parent ea97133e94
commit 732e94899c
10 changed files with 148 additions and 107 deletions

View File

@@ -73,6 +73,14 @@ namespace Nuake {
return Coral::Array<float>::New(results);
}
Coral::Array<float> Raycast(float fromX, float fromY, float fromZ, float toX, float toY, float toZ)
{
const Vector3 from = { fromX, fromY, fromZ };
const Vector3 to = { toX, toY, toZ };
auto hits = PhysicsManager::Get().Raycast(from, to);
return ConvertHitsToArray(hits);
}
Coral::Array<float> ShapeCastCapsule(float fromX, float fromY, float fromZ, float toX, float toY, float toZ, CapsuleInternal capsuleInternal)
{
auto capsule = CreateRef<Physics::Capsule>(capsuleInternal.Radius, capsuleInternal.Height);
@@ -104,6 +112,7 @@ namespace Nuake {
RegisterMethod("Debug.DrawShapeCapsuleIcall", &DrawShapeCapsule);
RegisterMethod("Debug.DrawShapeCylinderIcall", &DrawShapeCylinder);
RegisterMethod("Physic.RayCastIcall", &Raycast);
RegisterMethod("Physic.ShapeCastCapsuleIcall", &ShapeCastCapsule);
RegisterMethod("Physic.ShapeCastBoxIcall", &ShapeCastBox);
}