我找了一个答案,但还没有找到答案 . 我有一个椭圆轨道,我想在3D空间中围绕路径移动轨道体 . 目前的尝试没有成功 . (对象在periapsis处减慢并在apoapsis处加速,或者只是在NaN值处断裂)
可用值包括:半主要,半次要,速度,近地点,远点,当前轨道的身体位置,以度或弧度,以及两个质量距离 .
更多信息将有所帮助 . 但我建议你使用内置刚体组件的unity . 你需要在这里https://www.physicsclassroom.com/class/circles/Lesson-3/Newton-s-Law-of-Universal-Gravitation获得身体质量中心,然后再乘以那个向量并乘以你的方向 . 这个功能可以帮助你做到这一点https://docs.unity3d.com/ScriptReference/Quaternion.LookRotation.html当你的方向乘以你的力量后,使用 RigidBody.AddForce() 并发送你的矢量 . 我建议使用 Physics.OverlapSphere() for 那个任务看到https://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html并将所有这些逻辑放在身体上're orbiting. Than all you need to do is get the body you want to orbit to be in the right spot with the right velocity and you'll得到你的结果 . 只要确保关闭重力并使你的质量正确
RigidBody.AddForce()
Physics.OverlapSphere() for
1 回答
更多信息将有所帮助 . 但我建议你使用内置刚体组件的unity . 你需要在这里https://www.physicsclassroom.com/class/circles/Lesson-3/Newton-s-Law-of-Universal-Gravitation获得身体质量中心,然后再乘以那个向量并乘以你的方向 . 这个功能可以帮助你做到这一点https://docs.unity3d.com/ScriptReference/Quaternion.LookRotation.html当你的方向乘以你的力量后,使用
RigidBody.AddForce()
并发送你的矢量 . 我建议使用Physics.OverlapSphere() for
那个任务看到https://docs.unity3d.com/ScriptReference/Physics.OverlapSphere.html并将所有这些逻辑放在身体上're orbiting. Than all you need to do is get the body you want to orbit to be in the right spot with the right velocity and you'll得到你的结果 . 只要确保关闭重力并使你的质量正确