stuck pedal for scenerio creation

Discussion in 'Content Creation' started by ThreeDTech21, Sep 23, 2015.

  1. ThreeDTech21

    ThreeDTech21
    Expand Collapse

    Joined:
    Sep 27, 2013
    Messages:
    1,616
    How do I simulate a stuck pedal? My scenario will be a runaway car, no brakes and stuck pedal, how do I get the game to make the drive pedal stuck?
     
  2. DerpSheep

    DerpSheep
    Expand Collapse

    Joined:
    Nov 22, 2014
    Messages:
    116
    You might need to mod in your own vehicle for this, although there is probably some way to accomplish it with a script, but you would need to do some research on this. As for a custom vehicle I think adjusting the torque curve, idle RPM and braking coefficient might do what you want. Try setting the torque curve to a constant, setting the idle RPM to whatever the constant you want in the torque curve is, and setting brakingCoefRPS to 0. There is a large chance this won't work, but it might send you in the right direction. You probably want help from someone with experience scripting events into scenarios for a proper setup without a separate vehicle just for the scenario.
     
  3. Scepheo

    Scepheo
    Expand Collapse

    Joined:
    Feb 10, 2015
    Messages:
    601
    By overriding the player's input commands. Something like this should do the trick:
    Code:
    local M = {}
    
    local player
    
    local function onRaceStart()
        player = scenetree.findObject("scenario_player0")
    end
    
    local function onRaceTick(raceTickTime)
        if player then
            player:queueLuaCommand('input.event("axisy0", math.huge)') -- Throttle
            player:queueLuaCommand('input.event("axisy1", -math.huge)') -- Brake
            player:queueLuaCommand('input.event("axisy2", -math.huge)') -- Parking brake
        end
    end
    
    M.onRaceStart = onRaceStart
    M.onRaceTick = onRaceTick
    
    return M
    
    The math.huge is used to ensure that the player input is overwritten completely: as far as I can tell the applied input is calculated by adding the input values for each device, this seems to ensure that the resulting value will always max out.
     
  4. ThreeDTech21

    ThreeDTech21
    Expand Collapse

    Joined:
    Sep 27, 2013
    Messages:
    1,616
    Will try this out! thanks all ;)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice