Bouncing Ball issue

Post your own tutorials, guides and demos.

Post » Fri Sep 04, 2009 1:34 pm

I have made these two caps to illustrate an issue I'm having with the Ball behaviour.

The BB cap uses the ball behaviour. The ball has no randomness, so it should bounce at a steady 45 degree multiple. However, if you use the debugger, you can see that the bouncing has a very obvious variance to it.

The CMB cap uses the custom movement behaviour. The angles for speed, angle and collision response are basically the same, but in this case the ball bounces exactly as I expect it to.

Why is this? I don't have a problem using CMB for these things, but it would be so much more logical to use a ball. As far as teaching goes, I don't want to have to tell my students "don't use the ball behaviour for the ball".

On a side note - I could display the angle of movement for the CMB in the text object using the expression "Ball[CustomMovement].Angle", but I couldn't do the same thing with the Ball behaviour. Is there a way to do this?
B
2
S
2
G
3
Posts: 105
Reputation: 1,510

Post » Fri Sep 04, 2009 5:18 pm

hehe cool, I made the Custom Movement Behaviour and its great to see it works so accurately! The ball movement was written a year ago and seeing as the code in CMB appears to work better for bouncing we'll probably end up incorporating the new code into the Ball Movement so it bounces as expected.

I'd recommend using the CMB over the bouncing ball because it has more functionality and I plan to add more actions to do easy stuff like gravitationally pull an object towards another object or position etc.

If you tick the 'rotate object' option, you can use Sprite.Angle to get the angle of motion. Otherwise, you will need to do something like this:

angle(0,0,Sprite[Ball].VectorX, Sprite[Ball].VectorY)

to get the angle out of the x and y components, which is rather ugly :(

As for teaching your students, maybe it can be a valuable lession not to judge something by its name. Just coz a program is called 'FPS Creator' doesn't mean its the best program to use if you want to make a 3d first person shooter. Although I agree a bouncing ball should bounce at least as well as the custom movement behaviour.
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Fri Sep 04, 2009 5:46 pm

Looks like David beat me to it.
...mmh yeah wut he said, all of it.

Oh and if you don't want the actual angle shown you can use set animation angle.
Btw looks like we need a get animation angle call.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Sep 04, 2009 10:32 pm

Thanks for the reply guys. My plan was to introduce the CMB later on when things start to get more complicated. For the first couple of lessons, making games like PONG/Breakout, I was hoping to be able to keep things simple, i.e. Ball, 8-Way, etc. No big deal - the students probably won't even notice the inaccuracy (just my own perfectionism rearing its ugly head), and those that do can be pointed in the direction of the CMB.

As far as the expression is concerned, I was just wondering why "Ball[CustomMovement].Angle" works, but "Ball[Ball].Angle" doesn't.
B
2
S
2
G
3
Posts: 105
Reputation: 1,510


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests