How to have 3D rotation of a trajectory line in a 2D Game rotate depending on input position

21 views Asked by At

I've had a codementor try and help me figure out how this game is doing this 3d rotation of their trajectory line but we couldn't get it to work yet in Unity.

Game that does the rotation I'm trying to replicate
https://guselect.itch.io/cheese-bit





Here's the code we attempted to emulate it with butit  ultimately doesn't work
   var worldClickPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            var facingDirection = (worldClickPosition - playerScript.transform.position).normalized;
            var angle = Vector3.Angle(Vector3.right, facingDirection);
            var rotation = Quaternion.Euler(0,angle - 90f, angle -90f);
            trajectories.Rotate(Input.mousePosition);
0

There are 0 answers