I am looking for a way to have an object undergo normal physics and also follow a path (e.g. spline). Think of a roller coaster as a good example. Basically I want to have an object follow a predefined path while accelerating and decelerating appropriately. Friction would be a nice addition as well. What do you think the best way to go about doing this is? I have been searching for awhile and cannot find what I need.
How can it both undergo physics and follow a preset path? You need to think some more about your requirements because at the moment they are pretty contradictory.
You need to be much more specific about the exact behaviour you need - hopefully working out that specification will also give you some ideas for how to go about it.
I am basically trying to create a roller coaster. I have a spline for the track, and I want a car to follow it. I am looking for a way make the car follow the track but also have the velocity and acceleration calculations done by jbullet. Is something like this even possible?
Bullet is the wrong tool for the job since the coaster is on rails.
Just use the formulas for potential energy, kinetic energy and friction (they are all very simple) and you can solve for them each frame (total energy in the system remains constant) to see what acceleration or deceleration to apply to the roller coaster car.
Thank you for your reply! I guess my question was very vague because I honestly had no idea how to go about this. I am a mechanical engineer, so I will have no trouble with the equations, but my knowledge of programming practices is limited (especially when it comes to games). Sometimes I really just don’t know when I should write something from scratch (like now), or use something that has already been written for me.
Perhaps I have a better question now. What is the best way to force an object to follow a path? Should I use a MotionPath, or is there another/better way? I appreciate all of your help zarch!
Just make the physics objects kinematic, this way you can mve them and they will bump away other objects. But they will be like “unstoppable forces”, you’d have to check for stopping because of collisions yourself.
Yeah, I was sort of assuming that a roller-coaster simulation wouldnt have collisions
There are various types of curve provided for you in the jme libraries - you can have the object follow one of them.
Alternatively you could create your model for the rollercoaster and somehow have the objects follow the model - either by creating special nodes/geometries as waypoints or by doing something more specific and customised.