Big update
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user