- Home /
Looking ahead Physics2D?
//// How would I update the physics2d rapidly between frames to precognitively figure out where an object will be lets say 120 frames ahead?
//// Or whats a good method of estimating where an object, using physics2D, will be "In the future"?

In order to answer a question like this one, you will need to fix some things. For example the easiest would to have a constant velocity, but you could do it with an initial velocity and a constant acceleration (this is what happens with a projectile and gravity). Frames has to me FixedUpdate() so you can calculate the end time.
I figured it was either not possible to update the physics quicker or it would be really computationally expensive.
I'm attempting to create some sort of navigation for my 2d platform bots, as of now I'm saving vectors on 5 different ways of jumping, then i'll use that to do a series of raycasts to see if the jump will work out.
I thought it would be cool to figure exactly where they would end up in the physics engine then go off that.
Answer by komodor · Aug 20, 2014 at 01:24 PM
you can't do it by Physics2D or Physics, you must use your own predictive formula to get the info for bots - i'd suggest to precompute and hardcode array of coordinates for every movement type they will use (jump up, jump left, move left etc.) and then you can every update get intersection of the curve with world colliders
Sorry i never really responded, but I did what you said and it worked pretty good. I wrote a some code that stored the positions of the object in air for a couple different kinds of jumps. Then used that to raycast and check for good jumps.
nice :D don't hesitate to mark the answer as correct, maybe someone else might find it useful
Your answer
Follow this Question
Related Questions
Deterministic physics options 2 Answers
2D Raycast Layer Mask not working 1 Answer
How can i make a ragdoll stickman controller? 0 Answers
Is there a way to create water like behavior. 0 Answers
[SOLVED] Physics2D OverlapCircle 2 Answers