Forum rules - please read before posting.

Implementing a "Quick Turn"

I'm working on a tank-control 3d game and I'd like to use active input to implement a quick-turn feature, like seen in the old Resident Evil games (from 3 onwards I believe) so the player can do a quick 180.

I know we already have a turn to face action, and I guess I can play an animation that coincides with it, but the way I understand it is, just playing the animation wouldn't really turn the character, it would just play the animation. Also AC already has a turn parameter used for regular turning movement, so I'm not sure how to go about it.

Comments

  • edited January 17

    //code didn't quite work

  • You can quick-turn the Player by calling their SetLookDirection function, passing in the inverse of their forward direction:

    AC.KickStarter.player.SetLookDirection (-AC.KickStarter.player.transform.forward, false);
    

    To call this from an Active Input, place in a public function in a new C# script, attach to a GameObject and make it a prefab. Then call this prefab's function using the Object: Call event Action as part of that Active Input's ActionList.

  • Thanks Chris I'll give it a go. I always thought Call Event couldn't be used on prefabs in ActionList Assets though?

  • They can reference a prefab, but not use the Constant ID system to have it refer to the prefab's scene instance at runtime.

    In this case, however, you don't need it to - as the script/prefab accesses the Player only through static references.

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.