How do I prevent fast sliding on solids?

0 favourites
  • 2 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • If you open the 3d FPS example, you'll notice that rubbing against walls/solids makes the player just zoom down the wall. I've been playing with rot.js and making 3d procedural mazes/dungeons, but moving through the corridors is tricky with the player speed jumping up every time they touch the walls. Is there any way to keep the player from sliding like that? Thanks!

    Bonus question: I use the car behavior to move forward/backward/turn, but have to use custom movement to strafe left/right. This has the unintended effect of making diagonal movement 2x speed, any way to negate this?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If the motion is done with behaviors the collision response when moving along walls has never been great. There hasn’t been much traction in getting it fixed either.

    Smoother wall sliding can be done with events. A fair amount of ideas here:

    construct.net/en/forum/construct-2/how-do-i-18/8-direction-behavior-slide-95148

    When you use two behaviors to move an object at once their velocities are combined. Probably the simplest solution would be to divide the speeds by sqrt(2) when you’re moving and moving sideways to counteract the speed up. Or you can cap the speed by measuring the speed with

    Speed= Distance(0,0, sprite.behavior1.velocityX+sprite.behavior2.velocityX, sprite.behavior1.velocityY+sprite.behavior2.velocityY)

    Then when that’s more than a maxSpeed you’d multiply the speeds of both behaviors by:

    MaxSpeed/speed.

    If a behavior doesn’t have velocityX/y the usually have speed and angleOfMotion. You can calculate xy velocity from that

    Vx=speed*cos(angle)

    Vy=speed*sin(angle)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)