I'm trying to create a raycast suspension car, but I have ran into a very strange issue; when the car moves/accelerates it seemingly gets pulled down to the ground, and when it stops it's fine again. Here is the car in action:

(Console is printing current spring velocity)
Here is the spring code:
Vector3 springdir = wheel.GlobalTransform.Basis.Y;
float length = wheel.GlobalPosition.DistanceTo(wheel.GetCollisionPoint());
float springvel = springdir.Dot(getpointvel(wheel.GlobalPosition));
float offset = (restlength-length);
float force = (offset*stiffness)-(springvel*damping);
ApplyForce(force*springdir,wheel.Position);

This is the "getpointvel" function:
private Vector3 getpointvel(Vector3 point)
{
return LinearVelocity+AngularVelocity.Cross(point-GlobalTransform.Origin);
}

I tried replacing the point velocity with the object space linear velocity's Y, but the problem still remained, so I'm guessing the problem is caused by either the way I calculate the distance from raycast origin to ground or I'm doing the dot product wrong. Any help is appreciated

    mechanize Also forgot to mention, I am using Jolt physics but I tried the default Godot physics engine and the issue still persists.

    mechanize

    mechanize Im assuming this is caused by the way I calculate the raycast distance, as I just tried a different spring solution and the problem is still there.
    Vector3 springdir = wheel.GlobalBasis.Y;
    float length = wheel.GlobalPosition.DistanceTo(wheel.GetCollisionPoint());
    float springforce = stiffness*(restlength-length);
    float springvel = (springlengths[i]-length)/(float)delta;
    float dampforce = damping*springvel;
    ApplyForce((springforce+dampforce)*springdir,wheel.Position);
    springlengths[i] = length;

      mechanize I managed to find a solution, turns out for whatever reason the raycast distance calculation wasn't working properly. I used this to calculate the distance instead:
      -wheel.ToLocal(wheel.GetCollisionPoint()).Y