Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collision glitch #65

Open
Elinvention opened this issue Jul 5, 2016 · 8 comments
Open

Collision glitch #65

Elinvention opened this issue Jul 5, 2016 · 8 comments

Comments

@Elinvention
Copy link

I had fun enjoying Serious Sam The Second Encounter until I reached the level where there is a rotating floor. When the floor begins its rotation, Sam sinks into floor and dies.

This assertion fails and seems to be related:

Assertion failure at CheckTriangleAgainstEdges (/home/elia/Progetti/Serious-Engine/Sources/Engine/Brushes/BrushTriangularize.cpp:530), triggered 1 time:
  'itbed->bed_pbvxVertex0 != tr_pbedBottom->bed_pbvxVertex0 ||itbed->bed_pbvxVertex1 != tr_pbedBottom->bed_pbvxVertex1'
@lukassup
Copy link

I have experienced a quite similar issue while walking up the ramps in the first level of TSE (in the room where you get the invulnerability powerup and shoot skeletons). The camera rolls around and it is impossible to continue playing. It does not throw any exceptions however.

@DanielGibson
Copy link

@lukassup this: #48 ?
Not sure if this issue is related, but could be.

@lukassup
Copy link

lukassup commented Jul 26, 2016

@DanielGibson looks really similar to what I experience, probably the same issue.
EDIT: I wasn't using the flag mentioned in the title. I have built the engine for 64bit linux with:
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
$ ninja

@ptitSeb
Copy link

ptitSeb commented May 23, 2017

Does anyone knows if this glitch (in "The Pit") also happens with upstream build on Windows?
I does happens for me on x86/Linux and on arm/Linux.

@ptitSeb
Copy link

ptitSeb commented May 25, 2017

I tested on Windows, with a freshly built OpenSource version from upstream (built with VS 2015), and the bug is also there.
So it's not a Linux only issue.

@ptitSeb
Copy link

ptitSeb commented May 25, 2017

But the same save state on the Steam version works flawlessly.

@ptitSeb
Copy link

ptitSeb commented May 27, 2017

In case someone is still interested in this: I have fixed the issue.
tl;dr it was Sin/Cos function not always behaving properly. The fix is on my github repo (ptitSeb@dce3915) and on a Pull Request here.

Long story:
I debugged, using many printf (well, the Windows/VS equivalent of it) to try pinpoint the wrong value when Sam goes through the tilting floor.
Eventually, I found out that a rotation matrix was wrong.
Issue was inside
void CSimpleProjection3D_DOUBLE::ProjectMapping(const CMappingDefinition &mdObject, const DOUBLEplane3D &plObject, CMappingDefinition &mdView) const
Using some more printf, I was getting (from the Prepare method):
for a rotation matrix using Angle3D {90,-3.18055e-15,8.125} if I transform FLOAT3D(0,1,0) I get (0, 0.989962, 0.141333) which seems correct.
But for the next step (of the rotation floor), I had
Angle3D {90,-3.81667e-14,9.37499} so very similar angles, the same FLOAT3D(0,1,0) got transformed to (0.986643, 0, 0.162895) wich is all wrong (and make Sam fall!).
The rotation matrix calculation seems good.
But the Sin and Cos functions themselves.. They have a complicated prologue to get the quadran and so, and then call regular sin function (probably, at first, it was a single SIN table that was called, or something similar). Commenting all this and simply call regular sin/cos function fixes the issue...

The fix works on Linux and on Windows builds.

@DanielGibson
Copy link

Awesome, thanks so much for debugging this (and also your other improvements)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants