Inconsistent Bouncing

Get help using Construct 2

Post » Thu Dec 13, 2012 8:52 pm

While experimenting with the "bouncing bullets" example I noticed that the bullets do not "bounce"(or deflect) in a consistent direction. At times it looks as though the bullet is not colliding with the "block" at the same point in its travel toward the block(distance from block) despite leaving the player in the same position...perhaps this has something to do with the varying "bounce" behavior?...but then why would it collide at a different point?
Whatever the cause, I am wondering how I can fix the inconsistency. I know many questions have been asked regarding the "bouncing" behavior but I have yet to find an answer that satisfies my needs...or maybe I'm just too much of a noob to SEE the answer.

Thanks for any help you can offer.

B
3
Posts: 2
Reputation: 454

Post » Fri Dec 14, 2012 6:31 pm

The problem lies in the fact that a bullet will move with respect to dt. dt will change all the time by tiny amounts, which means the bullets will move different distances every tick. If the speed of the bullet is high, it will move farther every tick.

The bullet will register its collision with a wall only once a tick. So, every bullet will probably move a different distance 'into the wall' before it executes the bounce code. This will give naturally inconsistent bouncing if you are at an angle.

There's not much you can do, apart from using physics with 'framerate independent' set to off.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Dec 17, 2012 6:18 pm

Thank you very much for the response...I suspected it might be due to something like that.
I wondered if perhaps I could make use of something similar to the laser set up in:
http://www.scirra.com/construct2/demos/cant-turn-it-off

I'm not sure if I could modify that "laser" to be a moving object or a series of moving objects that die when colliding with a wall but at the same time spawn a new object of same type at the appropriate angle to achieve the "bounce" effect.

As I said, I am new at this and just trying to see what I can do with it...still have lots to learn, no doubt.

Thanks again.
B
3
Posts: 2
Reputation: 454


Return to How do I....?

Who is online

Users browsing this forum: ETgirl79, Google [Bot] and 19 guests