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 issue #76

Open
BielBdeLuna opened this issue Aug 16, 2015 · 6 comments
Open

Collision issue #76

BielBdeLuna opened this issue Aug 16, 2015 · 6 comments

Comments

@BielBdeLuna
Copy link
Member

@motorsep dicussed it here: OpenTechEngine/Discussions#11

Apparently user "NagaHuntress" (from some community) fixed it with this diff:

    Index: cm/CollisionModel_translate.cpp
    ===================================================================
    --- cm/CollisionModel_translate.cpp     (revision 6527)
    +++ cm/CollisionModel_translate.cpp     (working copy)
    @@ -294,11 +294,25 @@
                            // FIXME: do this normalize when we know the first collision
                            tw->trace.c.normal.Normalize();
                            tw->trace.c.dist = tw->trace.c.normal * start;
    +#if 0
                            // make sure the collision plane faces the trace model
                            if ( tw->trace.c.normal * trmEdge->start - tw->trace.c.dist < 0.0f ) {
                                    tw->trace.c.normal = -tw->trace.c.normal;
                                    tw->trace.c.dist = -tw->trace.c.dist;
                            }
    +#elif 1
    +                       // make sure the collision plane faces the direction of the trace
    +                       if ( tw->trace.c.normal * -tw->dir < 0.0f ) {
    +                               tw->trace.c.normal = -tw->trace.c.normal;
    +                               tw->trace.c.dist = -tw->trace.c.dist;
    +                       }
    +#elif 0
    +                       // make sure the collision plane faces the same way as the polygon plane
    +                       if ( tw->trace.c.normal * poly->plane.Normal() < 0.0f ) {
    +                               tw->trace.c.normal = -tw->trace.c.normal;
    +                               tw->trace.c.dist = -tw->trace.c.dist;
    +                       }
    +#endif
                            tw->trace.c.contents = poly->contents;
                            tw->trace.c.material = poly->material;
                            tw->trace.c.type = CONTACT_EDGE;

@DanielGibson
Copy link
Member

the original fix from treb:

--------------------- neo/game/physics/Physics_Player.cpp ---------------------
index af1a764..9ab46a8 100644
@@ -971,6 +971,9 @@ void idPhysics_Player::CheckGround( void ) {
    EvaluateContacts();

    // setup a ground trace from the contacts
+   gameLocal.clip.Translation( groundTrace, current.origin, current.origin +
+                gravityNormal * CONTACT_EPSILON, clipModel, clipModel->GetAxis(), -1, self );
+   /*
    groundTrace.endpos = current.origin;
    groundTrace.endAxis = clipModel->GetAxis();
    if ( contacts.Num() ) {
@@ -983,6 +986,7 @@ void idPhysics_Player::CheckGround( void ) {
    } else {
        groundTrace.fraction = 1.0f;
    }
+   */

    contents = gameLocal.clip.Contents( current.origin, clipModel, clipModel->GetAxis(), -1, self );
    if ( contents & MASK_SOLID ) {

not sure which one should be applied, maybe the bug should be re-investigated before that.
But at least we now have two possible fixes in the bugtracker :-)

@BielBdeLuna
Copy link
Member Author

ok

@BielBdeLuna
Copy link
Member Author

maybe NagaHuntress resolves this issues for all "collision models" while Treb's only solves it for players?

the thing is, is it a bug in the collision model system or is it a bug for the player specific collision model?

@DanielGibson
Copy link
Member

maybe someone should investigate, if this bug affects non-players (because I don't know.)

@BielBdeLuna
Copy link
Member Author

I've seen that normally when getting into noclip the position of the player never changed only the model stance, but never the position, but when getting stuck in the terrain, when getting into noclip (by pressing only and only only the "n" key (bound to noclip)) the player seems to move down a little bit, like if there where a force pulling him down (and I'm not crouching or moving at all)

then I've also spawned some monster_zsec_machineguners, and they don't seem to be stuck on any edge.

@BielBdeLuna
Copy link
Member Author

maybe even it's a two part problem, in the collision system but also in the player collision model?

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

2 participants