Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Collision

in Questions Posts: 10
I am wondering if there is a general best practice for collision because I’m having some trouble with consistency.

I’m working on a game and I’ve created collision boxes for walls that the character can’t walk through. They trigger collision flags depending on the direction that stop the character’s motion. The problem is that if the character’s speed is more than 1 pixel per frame, sometimes they completely skip over the edge detection entirely, clip inside and render the collision box useless. I’ve tried adding a bit of a buffer to the edge detection, but it’s becoming unrealistic and over complicated.

Does anyone have any suggestions?

Comments

  • dave1707dave1707 Mod
    Posts: 7,432

    @n0ogit Have you set physics.continuous=true . Look at the reference under physics. It should be at the bottom of the list.

  • Posts: 10
    Thanks @dave1707. If it does what I think it does it’ll be a godsend.
  • dave1707dave1707 Mod
    Posts: 7,432

    @n0ogit That might work under normal collision conditions, but if the object is going too fast, it will still go thru a barrier. More that 1 pixel per frame doesn’t sound fast. Do you have a small example of what’s happening.

Sign In or Register to comment.