Answers for "unity magnetize a 3d object to cursor"

C#
0

unity magnetize a 3d object to cursor

mousePosition = Input.mousePosition;
mousePosition.z = Mathf.Abs(cam.position.z - ball.position.z);
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
dir = mousePosition - object.position;
ball.AddForce ((dir).normalized * force);
Posted by: Guest on September-18-2021

C# Answers by Framework

Browse Popular Code Answers by Language