#Plane (Made of Cubes) falling slower than single cube

1 messages · Page 1 of 1 (latest)

long finch
#

Im working on the basic controls and physics for my flying game.

When i reduce throttle to zero the plane stops on x/z and starts falling on the y axis, but it falls very very slowly when compared to a single cube, i have a single rigidbody on a game object which all the plane parts are parented too.

Both the cube and the planes RB have the same settings so why is it falling so much slower? As far as i cant tell if im not touching W/S my code wont touch the planes y axis.

Plane Controll Functions

    void ThrottleControl(int direction)
    {
        // Adjust enginePower
        enginePower += direction * throttleResponse * Time.deltaTime;

        // Clamp the engine power between the minimum and maximum values
        enginePower = Mathf.Clamp(enginePower, minEnginePower, maxEnginePower);
        Debug.Log("Engine Power: " + enginePower);
    }

    void VelocityControl()
    {
        // Move forward with limited max speed
        currentVelocity = transform.forward * enginePower;
        currentVelocity = Vector3.ClampMagnitude(currentVelocity, maxVelocity);
        rb.velocity = currentVelocity;
        Debug.Log("Velocity: " + rb.velocity);
    }

    void AttitudeControl(float horizontalInput, float verticalInput)
    {
        // Yaw, Pitch & Roll
        yaw += horizontalInput * yawAmount * Time.deltaTime;
        pitch = Mathf.Lerp(0, 20, Mathf.Abs(verticalInput)) * Mathf.Sign(verticalInput);
        roll = Mathf.Lerp(0, 30, Mathf.Abs(horizontalInput)) * Mathf.Sign(-horizontalInput);

        // Apply rotation
        transform.localRotation = Quaternion.Euler(Vector3.up * yaw + Vector3.right * pitch + Vector3.forward * roll);
    }

Pictures of planes object setup and RB settings below

fervent zealot
long finch
#

So it is my script but i dont understand how

#

Is it that any form of x/z velocity even a tiny amount can drastically effect how gravity works

fervent zealot
long finch
#

i think you might be right

#

ill look into it

frank trench
#

you should add the current y velocity to the this line ```c#
rb.velocity = currentVelocity;