Forum rules - please read before posting.

Implementing Strafing

I have a "look mode" in my 3d, 3rd person, direct-controlled game, in which the camera is over the shoulder of the player. During this mode, the character is still able to walk. How can I trigger strafing animations (relying on the same Horizontal input as normal movement) instead of the usual walking animations when the player moves sideways?

Currently I can only get the player to walk forwards, regardless of which direction is pressed (even if you press back/down).
I have blend tree that has idle, walk forward, walk backward and strafe left and strafe right animations, but only the walk forwards seems to play. The parameter for walking forward and backward MoveSpeed, with the backwards walk supposed to play when MoveSpeed is a negative value, but only walk forwards activates.

Comments

  • Here as an AC tutorial of Chris that covers the topic:

  • Thanks guys, though I am not using First Person movement as my character needs to use Root Motion.

    How can I edit the script so that it will activate when my character enters the aforementioned "look mode" while remaining in direct-controlled movement method?

  • @Deckard_89 Ah ok sorry I don't know how I ended up assuming it is first person view.

    Ok sorry, now I get it. So you want to get a kind of control like in a 3rd person action game, where you need to strafe to keep the target inside your crosshair, maybe also with a target lock button like when you press space then it aims/rotates the camera and the player always to the target. Unfortunately, I am not a fast nor talented scripter otherwise I would have now started to script something like that as I need something like this as well. I postponed this task actually to a later stage of my game... and I am actually still hoping that a solution like UCC is on a sale on Black Friday :D because that would offer the fastest way to get it working as we want it and I don't need then to hack on my keyboard and can rather focussing on the game content.

    But if it is not on sale the next week,... well then I will have to code an AC solution and I will post here in this thread.

  • @Deckard_89 Though the wiki page's name suggests it, the script itself isn't strictly for first-person. It will work with a third-person character as well.

  • Hmm, not happening for me I'm afraid.

    I have added the parameters to the animator and the script to the character, the animations are setup. I have also tried on a clean/barebones character to make sure none of the Final IK components & stuff are getting in the way. Not sure what else to try.

    Do you have a working example of this @ChrisIceBox ?

  • It shouldn't require much more than the steps outlined in the wiki - though how you make use of the parameters is down to your Animator.

    Are the ForwardSpeed and RightSpeed values being updated, or are any errors appearing in the Console?

  • No errors are displayed in the console.
    The ForwardSpeed is always a positive value, it will not go below 0 so the walking backwards animation never plays.
    The character always turns instead of strafing, though the RightSpeed value is being updated, but only very slight, like 0.001. Setting the position value for the strafing on the blend tree very low might solve that, though it seems extreme.

  • Oh, I see. I thought the issue was that of animation playback - not the motion itself.

    You'd have to rely on First Person movement to get strafing - or use of a custom motion controller.

    One thing you can try is use First Person movement, but without attaching a First Person camera to your Player. You'll get an error message, but it should still work.

  • Yeah, using First Person movement does actually work, the only problem is you're not allowed to use Root Motion with it, so for example you walk backwards at the top of some stairs, the player will actually move over the stairs and be floating in mid-air (using character controller) until you stop moving/the animation ends - so they drop back down to Earth, lol.

    I might have to either: Use Rigidbody character controller or have the player remain in place when using this Look Mode.

  • the only problem is you're not allowed to use Root Motion with it

    You'll get a warning about it, but it shouldn't block anything. If the animations are set up and relying on the above script, and those animations rely on root motion, you may get it working.

  • Hey this is actually working, thanks again Chris.

    @Vacerias If you are following this thread, switching to First Person movement (with the linked wiki script applied to your character) works pretty well for allowing strafing/walking backwards. Though for the additional features you are looking for e.g. target lock etc you would need to script it (or integrate an asset from the store). Thankfully I do not need any of that so I am fine just with Adventure Creator right now.

  • @Deckard_89 Awesome that is great! I will give it a try

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.