[Solved]Perfect 90 Degrees

0 favourites
  • 6 posts
From the Asset Store
Avoid obstacles and survive as long as you can!
  • I am trying to get a perfect and consistent 90 degree bounce angle at any speed...

    I have put together two tests to show the issue I am having:

    bulletbouncetest.capx

    lower speeds remain more accurate for more bounces and the higher the speed the lower the accuracy. Am I doing something wrong? Shouldn't these tests render the same results each time even if they weren't pixel perfect?

  • Is there another simple way to accomplish this? an example would be great! Thanks!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the built in bounce isn't working (it should only work at a perfect 90 if you are moving in a straight line and hitting a 45 degree angled object) then you can test for on collision and then manually set the angle to +/- 90 degrees...

  • Could you look at the example that I have and add your suggestion to it, I cannot seem to get that to work for me...

  • Ok, I got something close enough to a solution that I can continue on with my project. It still messes up over speed of 1900, but that is enough of a speed range to work with.

    I started rounding the angle of the bullet motion to the nearest 90 degrees and the x/y position to the nearest multiple of 64 and made sure all my objects and origin points were positioned accordingly and voila.

    Special thanks to Mipeyon this postfor the rounding formula.

  • I'm guessing the collision is detected on a tick where the ball is not right at the center of the line. Every collision moves the ball a little further from the center, until the ball breaks free. Your solution is as good a way as I can think of to combat the issue.

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