#Assuming a somewhat realistic simulation
1 messages · Page 1 of 1 (latest)
Then you apply the maximum engine force in the opposite direction of the motion until v = 0. If you stop firing the engine at exactly the right time, you hit 0 perfectly
there is no "correct" amount of force you'd apply to reach 0 velocity. Any amount of force (big or small) will get you there
var velo = rb.velocity;
var v2 = velo.sqrMagnitude;
if (v2 > 0.01f)
{
var v = velo.magnitude;
var m = rb.mass;
var ddt = 2 * v * m;
var ddtAmp = ddt * ddt; * 59f; // amplified 59f because we're targeting 60fps so we can amplify the applied force
var jpf2 = jpf * jpf;
if (ddt2 > jpf2)
{
}
} else
{
rb.velocity = Vector3.zero;
}```
Also I set Time.maximumDeltaTime = 1f / 60f;
I'm trying to simulate a jetpack bring the astronaut to a complete stop.
you should not multiply your force by anything depending on your framerate
I disagree. Why do you say not?
you're welcome to disagree, but you are wrong.
It will introduce a framerate dependence into your game. AddForce already accounts for framerate
I'm trying to simulate a jetpack bring the astronaut to a complete stop.
Like when there is no input I want a damping effect.
if you start messing with stuff based on framerate, you'll be undoing that
It's true from the docs changes the velocity by the value of force * DT / mass but if we already know that the time between then next tick will have a limited duration. I think it works.
if(rb.velocity.sqrMagnitude > 0.01f)
{
rb.AddForce(dampingForce * (-rb.velocity.normalized));
}
else
{
rb.velocity = 0;
}
this does not account for DT or T
AddForce does it internally
Or it does because AddForce account for it.
I disagree
okay, you're welcome to do whatever you like
Because the formula in the docs DECREASES the F
But if we have more available
🤦♂️
What?
you literally passed in the amount of force to use
Force isn't time based?
acceleration = force * time
in this case
time is Time.fixedDeltaTime
which is small
I'm not trying to be diffacult here I swear I'm literally trying to understand.
you decide what force is available
you should pass in whatever you think is available
that has nothing to do with AddForce or the time step or anything
that's just what number you decide is the amount of force the thing can output
and definitely has nothing to do with framerate
So lets imagine an "engine" with a max force of 1 in all directions
It's supposed to be P
it has nothing to do with the physics you're asking about
momentum?
Okay let me do some more reading. Is it okay if I ping you later?
please dont
diick