How to create custom physics behavior

Hi, i’m trying to make a little flight simulation.
So i need to add forces to physics objects (planes) for example according to their orientation toward the velocity vector and the length of the velocity vector.

In my opinion it would be best if i could compute all my my extra forces at the point where jbullet computes the RigidBody forces an then sum all forces up to get the resulting forces. But it doesen’t seem that the RigidBody classes can be implemented that easy by oneself or can they?

If that doesen’t work what other ways are there to achieve this? The physics listeners seem to be of no use here because the subject has nothing to do with collisions. Or would it be possible to implement that with custom forces? Or would it be easier not to use jbullet at all?

Just use a tick callback, where in the code you do the calculations is irrelevant. Make sour own class that wraps the physics, use a Control, whatever. Theres absolutely no need to change a libraries code to add behavior but its a common beginner mistake to try that. Same with extending objects, one should always prefer composition.

1 Like