You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Improved ray shape (2D and 3D) by addiing the possibility to act as regular shape
This commit is contained in:
@@ -100,14 +100,16 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo
|
||||
|
||||
if (btResult.hasHit()) {
|
||||
|
||||
btVector3 ray_normal(ray_transform.getOrigin() - to.getOrigin());
|
||||
ray_normal.normalize();
|
||||
btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1));
|
||||
|
||||
if (depth >= -RAY_STABILITY_MARGIN)
|
||||
depth = 0;
|
||||
|
||||
resultOut->addContactPoint(ray_normal, btResult.m_hitPointWorld, depth);
|
||||
if (ray_shape->getSlipsOnSlope())
|
||||
resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth);
|
||||
else {
|
||||
resultOut->addContactPoint((ray_transform.getOrigin() - to.getOrigin()).normalize(), btResult.m_hitPointWorld, depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user