mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 04:57:23 +02:00
non-rounded collision solution in comments
This commit is contained in:
parent
5992651c27
commit
7464ca0879
1 changed files with 10 additions and 0 deletions
|
@ -606,6 +606,16 @@ bool sphereAACube(const glm::vec3& sphereCenter, float sphereRadius, const glm::
|
||||||
if (glm::dot(surfaceAB, BA) > 0.f) {
|
if (glm::dot(surfaceAB, BA) > 0.f) {
|
||||||
CollisionInfo* collision = collisions.getNewCollision();
|
CollisionInfo* collision = collisions.getNewCollision();
|
||||||
if (collision) {
|
if (collision) {
|
||||||
|
/* KEEP THIS CODE -- this is how to collide the cube with stark face normals (no rounding).
|
||||||
|
* We might want to use this code later for sealing boundaries between adjacent voxels.
|
||||||
|
// penetration is parallel to box side direction
|
||||||
|
BA /= maxBA;
|
||||||
|
glm::vec3 direction;
|
||||||
|
glm::modf(BA, direction);
|
||||||
|
direction = glm::normalize(direction);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// For rounded normals at edges and corners:
|
||||||
// At this point imagine that sphereCenter touches a "normalized" cube with rounded edges.
|
// At this point imagine that sphereCenter touches a "normalized" cube with rounded edges.
|
||||||
// This cube has a sidelength of 2 and its smoothing radius is sphereRadius/maxBA.
|
// This cube has a sidelength of 2 and its smoothing radius is sphereRadius/maxBA.
|
||||||
// We're going to try to compute the "negative normal" (and hence direction of penetration)
|
// We're going to try to compute the "negative normal" (and hence direction of penetration)
|
||||||
|
|
Loading…
Reference in a new issue