Throwing a ball against other object

Hemir

21-11-2007 01:13:00

Hi all!

I'm really a noob on Ogre. I have to do an exercise to college, but I really don't know how to do it... :cry:

The Ogre application that I have to do is:
--> Press space bar and throw a ball against a wall made of cubes. The origin of the throwing is the cammera.

I did the wall, but I don't have any idea how I should code the ball being throwing.

I'd appreciate any help. :wink:

Aquatix

21-11-2007 03:37:33

Are you using OgreOde then? Or wrapping Ode yourself? And, more importantly, are you using Ode at all? :)

Hemir

21-11-2007 11:32:03

Yeah, I'm using OgreODE.

Aquatix

21-11-2007 14:55:20

well, then on your "spaceBar_pressed" event you have:
create new body;
create new sphere geometry;
assign geometry to the body;
set body's position at the camera position;
set body's linear force to something in the camera's direction;
enjoy!

To get more code specific, visit the wiki or look at the demos.