Forum rules - please read before posting.

Weakened Player Control during Cutscenes / Triggerevents

Hey everybody!

I've been using adventure creator for some time now, with a project that doesn't require every aspect of it, but a lot of things come in handy. So I wanted to use it for scripted events as well. My issue:

I want the playable character to be controlled by some sort of force for this special event. So I'm using the cutscene script "Character: Move to point" to let him walk where he's supposed to. Now I would like to give the player the feeling of fighting against this force by having player input activated though weaker than the cutscenes script (the player can never win, it's just about game feel).

Is there any way to do so? So far I played around with pausing gameplay during the scene or not, which either results in no influence by the player at all (obviously) or every input by the player bringing him deeper into his own demise, but no movement whatsoever as long as the player doesn't interact.
The latter is kinda cool actually, but not what I'm looking for.

I'm using 'wasd' as movement keys (basic AC keyboard & controller controls) on a 3D player (who is a navmeshagent) using a navmesh, if any of that matters.

Thanks a lot in advance!
Schluhm

Comments

  • Welcome to the community, @Schluhm.

    The Character: Move to point Action is not designed to be "fought", but if your character is 3D and has a Rigidbody that has Is Kinematic left unchecked, then movement is handled by adding forces to it - so you might be able to exploit that by adding forces in the direction of input.

    Making sure that the game is in "cutscene" mode while this scenario occurs (i.e. by checking Wait until finish? in the above Action, and setting its ActionList's When running field to Block Gameplay, you could try attaching a custom script that - during this time - reads the "Horizontal" and "Vertical" input axes, converts them into a vector relative to the camera, and then applies a force in that direction upon the Player's rigidbody.

    Something like:

    void Update ()
    {
        float forceMultiplier = 1f;
        Vector2 input = new Vector2 (Input.GetAxis ("Horizontal"), Input.GetAxis ("Vertical"));
        Vector2 forceDirection = (input.y * AC.KickStarter.mainCamera.ForwardVector ()) + (input.x * AC.KickStarter.mainCamera.RightVector ());
        AC.KickStarter.player.GetComponent <Rigidbody>().AddForce (forceDirection * forceMultiplier * Time.deltaTime);
    }
    

    That's just an idea, though - I haven't tested it. If all else fails, you could set the Player's Motion control to Manual so that you have complete scripting control over their movement.

  • Hey Chris,

    thanks for the fast reply! I'm going to try exactly that! My character doesn't have a rigidbody as of now, since I had some trouble with the movement that way, but I'm gonna try to add one and activate the component only for the cutscene.
    Otherwise I'll write some manual control script.
    Either way, I'll post my final solution here, when I'm done.

    Thanks a lot!

  • Works perfectly fine with Rigidbody and your script! Adding animations that handle the characters movement gracefully is a whole nother story (obviously) but after playing around with the values for a bit, the amount of resisting the force looks good.

    Thanks again!

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.