From e654225970563660319d79a2c8488ec5bba9ce99 Mon Sep 17 00:00:00 2001 From: Weston Salinas Date: Sun, 26 Mar 2023 15:54:18 -0500 Subject: [PATCH] Fixes players and objects clipping out of stage with wall/ground portal - this fix was implemented by simply clamping the x and y of the localPoint to -0.1-0.1 and -0.2-0.2 respectively. - objects can no longer clip through stage - player can no longer clip through stage Fixes #13 --- README.md | 6 +++--- src/physics/rigid_body.c | 3 +++ src/physics/rigid_body.h | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e58430b..7bf0209 100644 --- a/README.md +++ b/README.md @@ -124,11 +124,9 @@ Where `/home/james/Blender/blender-2.93.1-linux-x64` is the folder where Blender - [ ] Ambient background loop ## Current Bug TODO List (Hardware Verified) (High->Low priority) -- [ ] Player can clip through any level by placing one portal on wall and another portal right next to it on ground. #13 - [ ] Player can clip through chamber 7 by walking back up the stairs (near the top). - [ ] player can clip through back of elevator by jumping and strafeing at the back corners while inside. -- [ ] Player can strap themselves in chamber 5 by following instructions issue #75 -- [ ] Any grabbable object can be clipped through level by wall/floor portals method. +- [ ] Player can trap themselves in chamber 5 by following instructions issue #75 - [ ] Two wall portals next to eachother can be used to clip any object out of any level by pushing it into corner, then dropping. - [ ] Glass can be walked through from one side on multiple levels (0,1,4,...) - [ ] Passing into a ceiling portal can sometimes mess with the player rotation @@ -140,3 +138,5 @@ Where `/home/james/Blender/blender-2.93.1-linux-x64` is the folder where Blender - [ ] Door at end of room 2, chamber 10 isnt rendered properly - [ ] various visual glitches when running NTSC on PAL console #65 - [ ] various visual glitches when running PAL on NTSC console #65 +- [x] Any grabbable object can be clipped through level by wall/floor portals method. +- [x] Player can clip through any level by placing one portal on wall and another portal right next to it on ground. #13 diff --git a/src/physics/rigid_body.c b/src/physics/rigid_body.c index ac4209e..f6945e0 100644 --- a/src/physics/rigid_body.c +++ b/src/physics/rigid_body.c @@ -177,6 +177,9 @@ void rigidBodyTeleport(struct RigidBody* rigidBody, struct Transform* from, stru transformPointInverseNoScale(from, &rigidBody->transform.position, &localPoint); + localPoint.x = clampf(localPoint.x, -0.1, 0.1); + localPoint.y = clampf(localPoint.y, -0.2, 0.2); + transformPoint(to, &localPoint, &rigidBody->transform.position); struct Quaternion inverseARotation; diff --git a/src/physics/rigid_body.h b/src/physics/rigid_body.h index 2b18c24..96fa34e 100644 --- a/src/physics/rigid_body.h +++ b/src/physics/rigid_body.h @@ -3,6 +3,7 @@ #include "../math/basis.h" #include "../math/transform.h" +#include "../math/mathf.h" #include "./collision.h" #define KILL_PLANE_Y -10.0f