Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Creating fictional RPM for a vehicle engine.

Discussion in 'Scripting' started by Timaman, May 13, 2016.

  1. Timaman

    Timaman

    Joined:
    May 15, 2013
    Posts:
    6
    So I acquired some code to simulate a motorcycle off the unity store, and I'm trying to modify it. Currently, the RPM is generated by multiplying rear wheel RPM by the ratio of the current gear:

    Code (JavaScript):
    1. EngineRPM = coll_rearWheel.rpm * GearRatio[CurrentGear];
    This means that RPM only exists when the bike physically moves, so the player cannot rev the engine whilst they have the rear brake on (useful for burnouts).

    I want change this so that the RPM comes directly from player input, instead of based on bike movement. Does anyone have any suggestions as to how I can do this?

    Thanks