📜  unity 将 3d 对象磁化到光标 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:23.695000             🧑  作者: Mango

代码示例1
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);