#Problem trying to simulate car engine and transmission

1 messages · Page 1 of 1 (latest)

sullen flume
#

Transmission:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Transmission : MonoBehaviour
{
    public float[] gearRatios;
    public AnimationCurve[] torqueCurveLookup;
    public float[] maxTorque;
    public int currentGear;
    public float currentGearRatio;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        currentGearRatio = gearRatios[currentGear];

        if (Input.GetKeyDown(KeyCode.E))
        {
            if (DoesGearExist(currentGear + 1))
                currentGear++;
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            if (DoesGearExist(currentGear - 1))
                currentGear--;
        }
    }

    bool DoesGearExist(int proposedGear)
    {
        if (proposedGear > gearRatios.Length - 1 || proposedGear < 0)
        {
            return false;
        }

        return true;
    }
}
#

All of the data I put in is based off of a 1990 corvette

#

To clarify: The problem I have is specifically with the engine losing power as it goes to higher gears, being less and less able to move itself forward. Here is a video:

#

I was holding full throttle the whole time

#

Every time you hear the engine go to a different pitch rapidly, I shifted down gears

south coral
#

you're decreasing the torque

#

@sullen flume based on your pfp and name I feel like you understand cars more than me, so perhaps I am misunderstanding

#

an engine outputs it's maximum torque at a specific rpm

#

why do you need so many torque curves

sullen flume
#

i ended up using one torque curve to simplify it

south coral
#

As I suggested

sullen flume
#

Yep lol

#

Thanks

south coral
#

Problem solved? Or no

sullen flume
#

Partially

#

Not really actually

#

It’s a different problem now

#

Too much rpm

#

But it’s much less annoying

south coral
#

Problem solved? Or no

sullen flume
#

No

#

Sorry for not being clear

#

Now instead of losing power, it has too much rpm for each

#

It’s either one of the extremes

#

Although I wanna close this thread probably