mirror of
https://github.com/mwpenny/portal64-still-alive.git
synced 2024-10-19 22:27:36 -04:00
Merge pull request #86 from westonCoder/wall-ground-portal-bug
Wall Ground Portal Bug Fix
This commit is contained in:
commit
2542711c21
|
@ -125,11 +125,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
|
||||
|
@ -139,5 +137,6 @@ 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] Can shoot portals while holding an object
|
||||
|
||||
- [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
|
||||
- [x] Can shoot portals while holding an object
|
|
@ -82,6 +82,24 @@ float rigidBodyMassInverseAtLocalPoint(struct RigidBody* rigidBody, struct Vecto
|
|||
return rigidBody->massInv + rigidBody->momentOfInertiaInv * vector3MagSqrd(&crossPoint);
|
||||
}
|
||||
|
||||
void rigidBodyClampToPortal(struct RigidBody* rigidBody, struct Transform* portal) {
|
||||
struct Vector3 localPoint;
|
||||
|
||||
transformPointInverseNoScale(portal, &rigidBody->transform.position, &localPoint);
|
||||
|
||||
//clamping the x and y of local point to a slightly smaller oval on the output portal
|
||||
struct Vector3 clampedLocalPoint;
|
||||
clampedLocalPoint = localPoint;
|
||||
clampedLocalPoint.y /= 2.0f;
|
||||
clampedLocalPoint.z = 0.0f;
|
||||
while(sqrtf(vector3MagSqrd(&clampedLocalPoint))>PORTAL_EXIT_XY_CLAMP_DISTANCE){
|
||||
vector3Scale(&clampedLocalPoint, &clampedLocalPoint, 0.90f);
|
||||
}
|
||||
clampedLocalPoint.y *= 2.0f;
|
||||
localPoint.x = clampedLocalPoint.x;
|
||||
localPoint.y = clampedLocalPoint.y;
|
||||
transformPoint(portal, &localPoint, &rigidBody->transform.position);
|
||||
}
|
||||
|
||||
int rigidBodyCheckPortals(struct RigidBody* rigidBody) {
|
||||
if (!gCollisionScene.portalTransforms[0] || !gCollisionScene.portalTransforms[1]) {
|
||||
|
@ -94,6 +112,14 @@ int rigidBodyCheckPortals(struct RigidBody* rigidBody) {
|
|||
|
||||
enum RigidBodyFlags newFlags = 0;
|
||||
|
||||
//if only touching one portal, clamp object to edges of that portal
|
||||
if ((rigidBody->flags & RigidBodyIsTouchingPortalA) && !(rigidBody->flags & RigidBodyIsTouchingPortalB)){
|
||||
rigidBodyClampToPortal(rigidBody, gCollisionScene.portalTransforms[0]);
|
||||
}
|
||||
else if ((rigidBody->flags & RigidBodyIsTouchingPortalB) && !(rigidBody->flags & RigidBodyIsTouchingPortalA)){
|
||||
rigidBodyClampToPortal(rigidBody, gCollisionScene.portalTransforms[1]);
|
||||
}
|
||||
|
||||
if (rigidBody->flags & RigidBodyIsTouchingPortalA) {
|
||||
newFlags |= RigidBodyWasTouchingPortalA;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -10,6 +11,7 @@
|
|||
#define RIGID_BODY_NO_ROOM 0xFFFF
|
||||
|
||||
#define MAX_PORTAL_SPEED (1000.0f / 64.0f)
|
||||
#define PORTAL_EXIT_XY_CLAMP_DISTANCE (0.15f)
|
||||
|
||||
enum RigidBodyFlags {
|
||||
RigidBodyFlagsInFrontPortal0 = (1 << 0),
|
||||
|
|
Loading…
Reference in a new issue