Hey everyone, i'm having some trouble on getting the bounce to go off in the right direction. This has got to be one of the most frequented questions. At any rate here is the code i'm using, what happens is the ball does in fact bounce in the right direction, but at a very slow speed. What should i multiply this by to make it stay in line with the correct speed?
I'm, not sure what you meant with your last line: "What should i multiply this by to make it stay in line with the correct speed?" Multiply what by?
You are doing one thing that could cause a bug. You are checking if you are in a wall, not if you are going to hit a wall. It's best to look before you leap If you're inside a wall then it's too late, sometimes your bounce code might not be able to get it back out of the wall.
Ok, sorry for the convoluted question. basically what i need is to figure out how to make the object bounce off of a angled wall and leave with teh correct veloicty and angle. I'm totally stumped, i've been from this board to bit-101's. I'm just not getting it. Are there any good tutorials out there, or am i just over complicating the issue. Thanks.
I looked at the files, and while they are very interesting and well done, I must have missed the parts that are related to bouncing an object off of an angled wall. Would you mind explaining further?
ok, heres the code i'm using, it's been modified since the first few times, so now not only does it not bounce with the correct speed, but also at the wrong angle. So i submit this for your scruitny, any advice would be nice, but if no one can figure it out, please point me in the direction of the nearest angled bounce tutorial that (at least partially) explains some of the math behind it and how it works. enough rambleing, heres the code!
I am familiar with Bit's site, but this problim involves an Angled wall, not a straight vertical or horizontal, those are simple, if it's vertical, reverse the xspeed, horizontal, reverse the y speed, but if it's at say...a 33 degree angle, what then?
And, forgive me if i'm wrong, but it seems that you just did a blanket answer to several posts. Keith's tutorial is excellent for calcuating gravity, showing you how to "throw" things, and calculating friction, but it's not a tut for bounce, the only bounce it seems it covers is the bounce agains 0deg and 180deg walls. Honestally it does'nt seem like your actually trying to give a solution. But thank you for the attempt.
Last edited by Twisted_Mystic_7; 07-24-2003 at 12:41 AM.
Originally posted by Twisted_Mystic_7 I looked at the files, and while they are very interesting and well done, I must have missed the parts that are related to bouncing an object off of an angled wall. Would you mind explaining further?
oops sorry i probobly should have read your post more. Oh well i geuss i should learn some more math before entering the all mighty Math an Physics sector place thing
I found out what i was doing wrong!! It appears that if you read things litteral insted of saying "Hey i can use that", you can use them right. i'm using the equation set forth by Ed-Mack
Code:
R = 2W-P
R = reflection
W = Angle of the wall
P = the path the ball is traveling in comparison to the horziontal
the trouble was being caused by the fact that i was occasionally uising the actual rotation, which included negitive numbers, but according to Ed-Macks post, the number must be between 0 - 360. I was'nt paying attention, and allowed neg numbers. I changed the code to
Code:
wall = Math.Abs(_root.wall._rotation)
// Instead of
// wall = _root.wall._rotation