A quick question... how do I make a moving bullet object accurately bounce off straight walls?
there was a post on forum for CC about perfect collisions, can't find it now, but i have uploaded project file from that post
http://dl.dropbox.com/u/34375299/perfect%20bounce%20off%20circle.cap
Don't remember how made it, sorry :/
I don't have Construct Classic, so this file is not really much good. If it's any help, the walls are all perfectly vertical and horizontal.
You could try to apply force upwards on collision with the boundary sprites you specify. I also did a check to see if the X coord was < 200, so it's a little more realistic.
http://dl.dropbox.com/u/17612316/example/bouncy_ball.capx
Thanks, but the object is not a physics object. The problem really lies in the fact that the bullet does not know the angle of the surface it is hitting.
Search for "bounce", "bouncing", "bouncing ball".
There have already been topics about a similar subject you can learn a great deal from.
I remember someone even posting a formula to a pong ball behavior type, in events.
I saw this, however it does not solve the problem at all. All it does is make it move in the opposite direction - not bounce accurately.
Hi sqiddster
The only way I could figure out how to make an object accurately bounce off straight walls was to get rid of the bullet object, and use the CustomMovement object instead. Here is an example I made.
Bouncing Ball Example
You will have to play around with the CustomMovement actions if you want to adjust, or change things.
Hope this helps.
I managed to do the same thing as you, but with the bullet behavior. The ends of walls, however, present a problem.
What kind of problem are you having with the ends of the walls?
It goes into the ends of the walls if I reposition them in your example. Try it.
Are you using your bullet behavior instead of my Custom Movement behavior? The reason I ask is because Iv been trying to recreate this problem with no luck. Maybe it is just a bug with the Bullet behavior.
Create a square wall_x in the middle of the field. Whenever the ball hits the top it goes right through.
Hello sqiddster
Did you remember to give the wall in the middle a solid behavior? Because it is working for me. Here is my example:
Bouncing ball wall in the middle example
Maybe I'm misunderstanding your issue. If I am could you post a capx. for me to look at?
Develop games in your browser. Powerful, performant & highly capable.
Look closely at the bounce when the ball hits the top or bottom of the middle wall. It is certainly wrong.