0
\$\begingroup\$

First I will show a screenshot and explain the logic I think of and what I'm trying to do :

Diagram

In the diagram the circle is the player the big rectangle is the zone area for increase/decrease speed movement of the player and the small black rectangle is the target.

What I'm trying to do is to add some rules for this case.

I'm controlling the player in third person movement with the keys WSAD and the mouse to rotate around looking around. This is the player structure screenshot in the Hierarchy :

Player settings in inspector

There are few rules I'm trying to set for the player in this specific situation in the game and I want to make it generic so I can add the rules or create this behaviour in any place in the game when I need to.

The idea is when the player is getting inside the green zone rectangle facing the target make the player slow down to stop smooth. The green zone is the distance from the target to start slow down only if the player is facing the target.

If I rotate the player back facing away from the target in the green zone at any time increase the player speed back to normal speed.

The idea is that if in the green zone I rotate the player at any time and move hi he will decrease/increase the movement speed. Facing target decrease slowly to stop facing away from target increase the speed slowly to normal.

\$\endgroup\$
1
  • \$\begingroup\$ @Philipp I will try to explain without the scripts. \$\endgroup\$ Mar 22 '21 at 17:26

You must log in to answer this question.

Browse other questions tagged .