3

The speed vector, as all vectors, is already made of a magnitude and a direction. More specifically, you can compute the magnitude and direction from the vector. Take for example the vector \$ \vec{v} = \begin{pmatrix} 1 \\ 1 \end{pmatrix} \$ . You can extract the magnitude (\$ \sqrt{2} \$ ) and the direction (\$\begin{pmatrix} 1 \\ 1 \end{pmatrix} \$, 45° ...


2

The length units, for 3D graphics, are whatever. As long as they are internally consistent, it does not matter. For graphics. For physics units matter. However, you do not set the units. There is nothing different in game engine or its settings. In fact, the units for most engine only exist in documentation and in the mind of people. Except time, because ...


2

So I figured out a solution. I basically check the previous direction I got from my function (without rounding it) and check the angle with the new direction my sprite wants to go (without rounding it) by doing Vector3.Angle(previousVector,direction) and then verify if the angle is greater than 30. If it is, I change the direction. If not, I keep the ...


1

Disclaimer: There's probably an off-the-self way to get this result from Unity with a built in lerp of some kind. That's a fine idea & it would probably be my first choice. This answer is meant to explain how to get the result manually. Let's take the expression below apart, understand what it does & doesn't do, and then fix it: startPosition.x + ...


1

The engine's units are whatever you want want them to be. Wether one unit is a centimeter and your character is 100 units tall, or one unit is a meter and your character is 1 unit tall, in both cases the result will be the same. Plain numbers in a computer are unitless so you have to decide how to interpret them, i.e. what is their unit. What's really ...


1

One way is to internally handle everything in 2D, and remap the x-coordinate into a cylindrical space for your graphics. Here's a very simple example. Attach this to an object that moves in 2D space to have it move a corresponding mesh renderer in cylinder space. public class CylinderSpaceObject : MonoBehaviour { [SerializeField] private Transform ...


1

The convention I've observed in most modern games is neither option you've proposed. Instead, W or "Forward" on the stick usually corresponds to "Upward" on the screen from the current viewpoint, what we call "camera-relative" controls. This way, the player does not need to attend to which compass direction they're currently ...


1

There are lots of ways you could accomplish this, I'll just give you one to get started. Attach this script to a gameobject, and give it another gameobject as target to follow. Uncomment line 29 if you're using a top-down view. using UnityEngine; public class AssassinMove : MonoBehaviour { public Transform target; [Range(0, 10)] public float speed; ...


Only top voted, non community-wiki answers of a minimum length are eligible