Hello, just a few questions

koloa

22-05-2006 13:37:32

Hi. Just wanted to say awesome work on the physics wrapper. makes things very cool. =)

now my questions.

my first project id like to create a breakout clone. a game where a paddle is used to hit a ball towards a bunch of blocks to destroy.
my questions are:

how can i set the speed of the ball at a constant rate until i feel like speeding things up?

am i on the right track here with my thinking?
1. register block, ball, and paddle with the physics engine.
2. set the ball at a constant speed(or is it force)
3. use nxOgre to see if a collision is met to, if so, destroyEntity
4. etc...

Thanks

betajaen

22-05-2006 15:03:39

Yep you're on the right track there, you can give the ball a "little push" force to keep up with the right speed, but directly altering the speed is a no-no with Physics engines - in fact I don't think you can.

I'm thinking to keep the ball at a constant rate of speed, you'd have to reduce to friction to zero for everything (and have a high restitution for it to bounce of the blocks properly), then every frame or two, calculate the speed of the ball is travelling, then just go back to school physics and work out the force needed from f = m * a.

But it should work, as long as there is no friction or dampening.

There may be a un-expected effects due to gravity, with usual breakout type games once the ball hits something it inverts the direction of the ball, with NxOgre it'll do something more close to reality coupled with gravity pulling the ball down (assuming you have it on), the ball will gradually curve it's motion downwards. Something to think about.

Let me know how it goes. :D

lem_muppet

23-05-2006 06:53:12

Or so you dont have to worry about gravity, and the ball having a curving path, you could lay the entire scene out as if it were flat on a table, and the ball was rolling towards the blocks, instead of shooting up at the blocks.

Might be a bit easier to get the constant motion that u are after :)

betajaen

23-05-2006 09:10:15

That'd would work too. :D

Oh, you'll have to limit each body to certain directions, so the ball won't jump outside the table. It's very easy to do and there is even a function provided for it.

koloa

24-05-2006 14:52:01

hi, thanks for the reply guys. i take it that all the functions i need to set up the game correctly is by looking through the sample tutorial code?

i read the pdf manual and its turning out awesome. what i like about ogre and the people here, they can explain things in normal speach, makes things easier for me.

betajaen

24-05-2006 23:14:25

Pretty much. There's 21+ tutorials/demos to get you started, and a draft version of the book.

That'll keep you busy for a while. :D