Forum rules - please read before posting.

Switch Control Scheme

Hello,

my game is mainly a first person game where you walk around using the provided first person camera scripts and controls.
I want the player to be able to get in a car and drive around (also in first person)
I made the car a hotspot and gave it an interaction to move the camera into the car and make the car invisible.

What I want to do when I get in the car is switch from the first person control scheme (where space is jump) to a car control scheme (where space is handbrake for example).
I also might want to disable the firstperson player script (to stop the head bobbing etc.)

Is there an easy way to do this or do I have to create a system where Jump is checking whether I am in the car and apply the handbrake.

I know the Unity New Input System has the concept of ActionMaps. Does AC support this or do you have another way to provide this?

Comments

  • Driving around in a car would likely take some custom script work. You may get away with a Player that has very low Acceleration / Deceleration values, but AC's own movement code is all geared towards character motion, not vehicle.

    You wouldn't want to use the regular First-person camera either, as it can spin around the Y-axis in complete revolutions. Instead, use the Engine: Manage systems Action to change your game's Movement method to either None (and then use a custom script to move the car) or Direct (and then alter the Player's acceleration values).

    Either way, once the Movement method is no longer First Person, you can use the Camera: Switch Action to switch to a stationary camera. This can just be a regular GameCamera that's parented to your Player, in the same position / orientation as the First-person Camera, only it can't rotate independently of the Player.

    For the handbrake: again, you'd either rely on a separate asset that handles proper vehicle motion, or fake it with AC Direct movement. If you tried it with just AC, you could introduce a custom script that causes the Handbrake input to raise the Player's deceleration and lower their speed values. These can be affected through script with:

    AC.KickStarter.player.deceleration
    AC.KickStarter.player.walkSpeedScale
    

    If you're using Input System (and AC's integration template for it), then AC doesn't read or affect the state of ActionMaps - only the inputs directly. Since you'd need to detect Jump input for the Handbrake, I'd recommend instead renaming your Jump input to something else (e.g. CustomJump) so that AC no longer reads it directly, and then have your custom script read it instead. That way, you can either trigger the Player's Jump function, or affect the Handbrake, depending on whether they're in a vechicle or not.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.