c# - 加力的同时旋转物体

标签 c# unity3d

object layout and force way

如图所示,我想给父对象添加一个力,使其在向右和向上移动时旋转 90 度。我存储了对象下方的位置以帮助旋转运动,但我不知道如何将其放入代码中。

最佳答案

我想你要找的是AddForceAtPosition

Applies force at position. As a result this will apply a torque and force on the object.

GetComponent<RigidBody>().AddForceAtPosition(Vector3.right, child.transform.position);

关于c# - 加力的同时旋转物体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56843340/

相关文章:

c# - C# 中的局部变量

c# - 寻找增强算法 : Save game state

c# 我必须为新类实例指定名称吗?

c# - GUIText 已弃用,那么我应该使用什么来代替它呢?

android - 如何访问统一应用程序的android内部存储中的文件?

c# - unity rigidbody2d倾斜问题

c# - 在交换机中使用 'goto'?

c# - c# 中的 DateTime 和 SQL Server 中的 DateTime 之间有什么区别吗?

c# - Azure 辅助角色的多个实例有多少个队列?

C# 按日期对 Datagrid 列进行排序