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

Snaps to square even when snap is set to 0 #21

Closed
iCodeForBananas opened this issue Sep 14, 2016 · 12 comments
Closed

Snaps to square even when snap is set to 0 #21

iCodeForBananas opened this issue Sep 14, 2016 · 12 comments
Assignees
Labels
Milestone

Comments

@iCodeForBananas
Copy link

iCodeForBananas commented Sep 14, 2016

Video example of https://rangersteve.io
https://streamable.com/koh2

Just a consts file

    // Slope Plugin
    SLOPE_FEATURES: {
        acceleration: 1500,
        bounceX: 0,
        bounceY: 0,
        debug: 0,
        dragX: 1300,
        dragY: 0,
        enableGravity: true,
        frictionX: 0,
        frictionY: 0,
        gravity: 1100,
        jump: 400,
        minimumOffsetY: 1,
        pullDown: 0,
        pullLeft: 0,
        pullRight: 0,
        pullUp: 0,
        snapDown: 0,
        snapLeft: 0,
        snapRight: 0,
        snapUp: 0
    },

Where I set the player's slope very similarly to how it's done in the demo.

const body = this.player.body

    this.physics.arcade.gravity.y = GameConsts.SLOPE_FEATURES.gravity

    // Add a touch of tile padding for the collision detection
    body.tilePadding.x = 1
    body.tilePadding.y = 1

    // Set player minimum and maximum movement speed
    body.maxVelocity.x = GameConsts.MAX_VELOCITY_X
    body.maxVelocity.y = GameConsts.MAX_VELOCITY_Y

    // Add drag to the player that slows them down when they are not accelerating
    body.drag.x = GameConsts.SLOPE_FEATURES.dragX
    body.drag.y = GameConsts.SLOPE_FEATURES.dragY

    // Update player body Arcade Slopes properties
    body.slopes.friction.x = GameConsts.SLOPE_FEATURES.frictionX
    body.slopes.friction.y = GameConsts.SLOPE_FEATURES.frictionY
    body.slopes.preferY    = GameConsts.SLOPE_FEATURES.minimumOffsetY
    body.slopes.pullUp     = GameConsts.SLOPE_FEATURES.pullUp
    body.slopes.pullDown   = GameConsts.SLOPE_FEATURES.pullDown
    body.slopes.pullLeft   = GameConsts.SLOPE_FEATURES.pullLeft
    body.slopes.pullRight  = GameConsts.SLOPE_FEATURES.pullRight
    body.slopes.snapUp     = GameConsts.SLOPE_FEATURES.snapUp
    body.slopes.snapDown   = GameConsts.SLOPE_FEATURES.snapDown
    body.slopes.snapLeft   = GameConsts.SLOPE_FEATURES.snapLeft
    body.slopes.snapRight  = GameConsts.SLOPE_FEATURES.snapRight
@iCodeForBananas iCodeForBananas changed the title Sticks to slope even when 0 Snaps to square even when snap is set to 0 Sep 14, 2016
@hexus
Copy link
Owner

hexus commented Sep 14, 2016

If you comment out this line in your copy of the plugin, does it fix the issue? If not, then something else is causing this.

Try also updating to v0.2.0-alpha if you haven't yet. It contains a restriction whereby collisions are only resolved if a body is moving into a collision normal.

I'll be able to look at this a little more at a later date, as I'm somewhat ill today. 😷

@iCodeForBananas
Copy link
Author

Ok going to try this out today and I'll get back to you.

@iCodeForBananas
Copy link
Author

iCodeForBananas commented Sep 20, 2016

It still appears to be happening, it's pretty minor though.
Just to be sure I commented out the line on 498 because it moved.

@hexus
Copy link
Owner

hexus commented Sep 20, 2016

M'kay, hopefully I'll be able to reproduce this at some point and work out what's going on.

@iCodeForBananas
Copy link
Author

@hexus Is there a way to disable the snap functionality?
It tends to happen a lot when I'm moving very quickly.

@hexus
Copy link
Owner

hexus commented Oct 21, 2016

It's disabled completely unless any of these values are non-zero:

https://github.com/hexus/phaser-arcade-slopes/blob/v0.2.0-alpha/src/ArcadeSlopes/SatSolver.js#L287

So what you're seeing is likely because of the tunnelling issue you mentioned in #8, except in this case they're not falling through a tile, they're moving some way into it without any steps in between.

@iCodeForBananas
Copy link
Author

@hexus When we finish this build I'll test this out just to confirm and close this issue.

@hexus
Copy link
Owner

hexus commented Oct 24, 2016

Cool. 👍

@hexus
Copy link
Owner

hexus commented Feb 9, 2017

I've looked over the code again recently and it appears as though snap was running even with the values set to zero! Sorry that I missed this.

I'm actually thinking of removing the solution entirely, as the "pull" mechanic is a much nicer way of solving sticky tiles.

This will either be fixed, or the feature removed, in v0.2.0.

@hexus hexus added the bug label Feb 9, 2017
@hexus hexus added this to the 0.2.0 milestone Feb 9, 2017
@hexus hexus self-assigned this Feb 9, 2017
@iCodeForBananas
Copy link
Author

@hexus I was literally trying to find this yesterday because I had players mentioned it happening. I just ended up removing all of the snap stuff in a local build of the plugin.

@hexus
Copy link
Owner

hexus commented Feb 9, 2017

I think I'll remove it. 😁

hexus added a commit that referenced this issue Feb 9, 2017
Fixed collision snapping running when it shouldn't (#21).
@hexus
Copy link
Owner

hexus commented Feb 9, 2017

Fixed by the above! Will be in v0.2.0, and the feature itself will probably just be removed. 👍

Planning to get it released pretty soon, so michaeljcalkins/rangersteve-ideas#239 should be sorted soon. 😉

@hexus hexus closed this as completed Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants