Predict Rigidbody movement for aiming system

Hi everyone, I was looking for a way to predict a rigidbody trajectory for an aiming system. Allowing the user to see where is projectile would land given an angle and a force applied (basically like in most golf games). Is there any way, or function from Bullet that I could use to achieve that ? I do not need to predict obstacles, bounces or anything like that, but just to show a basic parabola. I was thinking of using the Pythagora algorithm with speed over time and considering the current gravity value in-game. I guess there is a more accurate way to do so.

Thanks,
Tristan

I’m afraid that bullet doesn’t have this. You would have to calculate the simulation yourself as you have suggested. :frowning:
You could throw an invisible object and track the position over time but you would also have to somehow hide the amount of time it takes for it travel the distance.

Thank you for your answer, I might actually throw an invisible object and draw something based on the results of the simulation, it will be the easiest way.

I’m having the same issue, want to predict movement of cue ball and other balls inside billard, tried EVERYTHING possible like multiple raycasts, calculation of angle etc nothing seems to be working, I really hate the approach of simulating invisible objects as it would increase processing cost by a lot.
Please tell me any work around possible?

Bullet physics is not deterministic so for something like billards, I would look at writing your own physics/collision system specifically for your game.

is there any other way than writing own physics???

I would have thought raycasting would be enough to get an indication of direction and collisions of balls to be honest.

Edit: ah wait, ideally you would won’t a sphere cast here right?

Get’s kinda complicated pretty quickly - especially since he wants to predict for all the balls. I did read that there are ways to make the bullet physics deterministic if you control/reset initial parameters sufficiently and, I think properly control sampling to match frame rates? There are some Reddit threads that explore this outside the context of PlayCanvas. But the OP doesn’t really want to do the simulation twice so investigating that may be a non-starter.

I have successfully integrated aiming system using ‘convexSweepTest’.
I threw a shape (sphere of some radius) using ‘convexSweepTest’, on hit , I am expecting callback of ‘ClosestConvexResultCallback’ which give me accurate ‘m_hitPointWorld’ points, on which I throw a raycastFirst to check entity, then draw a render line by calculating predicting vector which gives me about 80-90% accuracy.To achieve more accuracy, I need to somehow draw the shape (sphere) being raycasted.
I have tried using ‘debugDrawObject’ but it gives me assertion errors in ammo, can you please tell me a way to draw the shape being cast?
Thanks.