C
C#5mo ago
Kivrin

Simple Solution?

Big but possibly etremely simple c# question: I have these two scripts, PlayerOrbits, which controls the entire movement of the player, and Trajectory, which is supposed to show an exact prediction of where the player will go when you unpause the game. Currently, I have these two working on from what I can tell to be the same physics. Thing is, the two are ever so slightly different and it causes cool prediction stuff to get drastically far away from the intended route. Any ideas on why this might be happening?
2 Replies
Kivrin
KivrinOP5mo ago
Oh yeah, and the video shows what I mean. The first couple frames of the video show the predicted movement and then it shows how they end up deviating slightly and crashing
Vector
Vector5mo ago
your sim runs 20x more steps than real physics so i would probably do time.fixeddeltatime (float deltaTime = Time.deltaTime) and another you got force scaling so a quick lil thing instead of simulatedVel += acceleration; try doing simulatedVel = new Vector2(simulatedVel.x + forceX, simulatedVel.y + forceY);

Did you find this page helpful?