JV-ODE Physics Thread 3

Blitz3D Forums/Blitz3D Userlibs/JV-ODE Physics Thread 3

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi Pax, yeh pool games use simple reversed angles which are easy to implement. Working out a cannon ball trajectory is little more tricky, as there are several things to take into consideration like gravity, wind direction, air resistance, cannon balls weight/mass and the force used to shoot it from the cannon. You can work this out using some math, but it may not match exactly to the ODE simulation (which is what you would want ideally).

For best results, I would use ODE to work out the trajectory. Using this method will ensure that the actual ODE trajectory matches the previewed trajectory correctly.

What you need to do to achieve this is launch the cannon ball, and track (record) its trajectory/location at several intervals (maybe every 10 world steps?). But do not draw the cannon ball mesh when launching the ball, only track its location. You can use multiple spaces to prevent any collisions during the preview, or fire the cannon ball at a different location in your simulation (out of view).

Once you have tracked the previewed trajectory, you can use this data to highlight the path by placing spheres (or whatever object) at each location that you've recorded.