Big update

This commit is contained in:
2026-03-07 03:14:10 +03:00
parent f8f69d3b88
commit a998771486
33 changed files with 1788 additions and 577 deletions

View File

@@ -136,6 +136,26 @@ void PhysicsWorld::Step(float delta)
m_world->debugDrawWorld();*/
}
bool PhysicsWorld::TraceRay(TraceRayResult& _result, const glm::vec3& _rayBegin, const glm::vec3& _rayEnd, IEntityBase* _pIgnoreEntity)
{
btVector3 rayStart = glmVectorToBt(_rayBegin);
btVector3 rayEnd = glmVectorToBt(_rayEnd);
ClosestRayResultCallback RayResultCallback(rayStart, rayEnd, _pIgnoreEntity);
g_PhysicsWorld->GetWorld()->rayTest(rayStart, rayEnd, RayResultCallback);
if (RayResultCallback.hasHit())
{
_result.hit = true;
_result.pEntity = (IEntityBase*)RayResultCallback.m_collisionObject->getUserPointer();
_result.position = btVectorToGlm(RayResultCallback.m_hitPointWorld);
_result.normal = btVectorToGlm(RayResultCallback.m_hitNormalWorld);
}
return _result.hit;
}
void PhysicsWorld::ToggleDebugDraw()
{
m_debugDraw = !m_debugDraw;