For aeroplane physics, I use a linear and angular velocities for accurate representation, but since the Y velocity always increases as -gravity per second, with the velocities keep going more extreme until it eventually glitches through the floor as it’s so fast.
Here’s part of the source code that increases the velocity by the gravity force down every frame:
How do I accurately limit the forces down?
1 Like
If you want to cap the speed that the plane can move in each direction, you can use math.clamp
It allows you to set the minimum and maximum value that the number can be, and if it surpasses the value, it sets it back to the closest value that it is allowed to have.
Example:
-- Velocity.y = -100
-- The first value is the number that you want to clamp, the second is the lowest
-- That the value can be, and the last number is the highest that the number can be
Velocity.y = math.clamp(Velocity.y, -10, 10)
I don’t want to limit the velocity, but I want the velocity to stop increasing once its in a solid, stable surface for example
1 Like
The answer is really just that you have to implement collisions. If the plane is on the ground, its weight is cancelled out by the upward force of the ground against the plane, so there is no further acceleration. You have to also decide what happens to the plane’s downward momentum when it hits the ground; things don’t immediately stop of course, the momentum has to go somewhere, either absorbed by the ground (converted to displacements of earth and heat) the plane bounces (elastic collision) or anything on the continuum between.
1 Like
I’ve made this function to try to stop axes that would collide:
For context, the droneRay function is this:
1 Like