简体   繁体   English

如何在使用物理时在 SceneKit 中移动子节点及其父节点?

[英]How can I move children nodes with their parent node in SceneKit while using physics?

I have a rocket, earth and moon.我有火箭、地球和月球。 My rocket is added as a child to the moon, the moon is added as a child to the moon orbital node, and the moon orbital node is added as a child to the earth.我的火箭作为子节点添加到月球,月球作为子节点添加到月球轨道节点,月球轨道节点作为子节点添加到地球。 When the moon orbits around the earth, the rocket does not move with it while added as a physics body in the physics world.当月球绕地球公转时,火箭并没有随它一起运动,而是作为物理体添加到物理世界中。 I would like the rocket's physics body to move relative to its parent moon node, not relative to the entire scene.我希望火箭的物理体相对于其父月球节点移动,而不是相对于整个场景。 That way it will orbit the earth along with the moon.这样它就会和月球一起绕地球公转。 How can I achieve this?我怎样才能做到这一点? Thank you!谢谢!

我认为您正在寻找用Scenekit's行话焊接又名接头的物理机构, Scenekit's一下这个DOCS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM