playMaker

Author Topic: How do you make a character only move forward within an angle  (Read 1452 times)

RobbyS12

  • Playmaker Newbie
  • *
  • Posts: 4
How do you make a character only move forward within an angle
« on: December 24, 2020, 01:16:22 PM »
Hello. I'm trying to make a character move forward, but only at an angle. I don't want the character to be able to move perfectly horizontal or backwards. I hope the attached image will help illustrate what I mean. Thank you!

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: How do you make a character only move forward within an angle
« Reply #1 on: December 26, 2020, 07:38:52 PM »
Are you moving the character with translate or physics? You could set the x and z values of the translate to move diagonally (and for physics add force).
« Last Edit: December 26, 2020, 07:41:40 PM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool

RobbyS12

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How do you make a character only move forward within an angle
« Reply #2 on: December 26, 2020, 08:36:00 PM »
I’m super new to everything programming related so I’m not exactly sure if I’m using translate or physics to move the character. I just know I’m using a character controller on my character and I’m using a controller simple move in the FSM. I need the character to move very slowly while traversing hilly terrain. Do you have a specific way you would recommend for making my character move whether it be with translate or physics?

Thank you so much for helping me out. I really appreciate it!

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: How do you make a character only move forward within an angle
« Reply #3 on: December 29, 2020, 10:59:06 AM »
This is a tough one RobbyS12, I actually haven't used the character controller or simple move. I usually just create basic movements either by physics or translation and sometimes tweening but Im willing to look into it and try and help.

What is your intended movement (are you going to use the WSAD keys for moving diagonally(which ones) or point and click to move), because your very new its better to be clear now ;)

EDIT:
Please see attached for diagonal movement.
Its simply a capsule with a capsule collider and this FSM attached (no character controller and it uses the keys A and D to move diagonally), you don't have to use a capsule but it has a rounded bottom to help with your hills or you could use a sphere collider (also note to do things like climb stairs you would need to add a Rigidbody and you can freeze rotation for the XYZ in constraints).
« Last Edit: December 29, 2020, 11:54:21 AM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool

RobbyS12

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How do you make a character only move forward within an angle
« Reply #4 on: December 29, 2020, 02:21:17 PM »
I want to use WASD for my movement. I would also like to have a free range of movement between the two lines I drew. How would I be able to press A and W or D and W at the same time to move forward at different angles?

You have been so incredibly helpful. I really appreciate it. I did what you suggested and now I would just like to be able to move freely in between those two angles.

Thank you.

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: How do you make a character only move forward within an angle
« Reply #5 on: December 29, 2020, 03:22:01 PM »
Hi RobbyS12,

Have you tried something like this:
https://hutonggames.com/playmakerforum/index.php?topic=8032.15

My initial thought would be to try and clamp the rotation and keep your initial setup (Get Vector Axis, Controller Simple Move, Smooth Look At Direction) and ClampRotation from the Ecosystem. 
Have I said how much I love playmaker!!! This is one amazing tool

RobbyS12

  • Playmaker Newbie
  • *
  • Posts: 4
Re: How do you make a character only move forward within an angle
« Reply #6 on: December 29, 2020, 03:43:30 PM »
Hey thanks for getting back to me! I’ll take a look at this and try it in a few hours and let you know how it goes. Thanks again for the help.