page5 Node

page5
Node(理解起来像是xml,也幸亏如此,才能让编程变得简单点)
parents and children这种标题应该是重点
What are nodes?
1:A node is a spatial that can have other spatials as children(节点是空间体,能够作为其他空间的子)
2:The children of the node are moved and rotated relative to their parent node(子节点相对于其父节点上移动和旋转,我经过程序测试,貌似相对于父节点的移动旋转也是适用左手定则的)
3:The scene graph for example uses a base root node that all spatials are connected to(例举了场景中链接到跟节点的空间体)
得仔细看这些图例

node.attachChild(spatial);使用子空间体,这个函数是附上子空间体

spatial.move(0,1,0);Y轴方向移动

node.move(1.5, 0, 0); 沿X轴方向移动1.5米

the child spatial moves along with it, keeping its local translation relative to the node,子空间与它一起移动,并保持相对该节点的位置变化

node.rotate(0, 0, FastMath.HALF_PI); Z轴使用节点旋转半π即90°

the child spatial rotates along with it, keeping its local translation and rotation relative to the node 子空间体跟它一同旋转,并保持相对于该节点位置变化和旋转。

spatial.rotate(0,0, -FastMath.HALF_PI); Z轴方向的空间体旋转-90°

the child spatial now has a local rotation relative to the node
子空间体的位置旋转相对于节点

the child spatial rotates along with it, keeping its local translation and rotation relative to the node 子空间体跟它一同旋转,并保持相对于该节点位置变化和旋转。

spatial.rotate(0,0, -FastMath.HALF_PI); Z轴方向的空间体旋转-90°

the child spatial now has a local rotation relative to the node
子空间体的位置旋转相对于节点

node.rotate(0,0, -FastMath.HALF_PI);节点的Z轴方向旋转-90°

子空间体的旋转是相对于节点的

node.scale(2); 节点控制缩放2倍

note that the local translation of the child spatial is affceted by the scale of its parent node too
注意这种由缩放引起的子空间体的位置变换也会影响到他的父节点

spatial.scale(0.5);空间体缩放0.5倍

the local translation of the child spatial is still the same, scaled by the parent node (子空间体的坐标依然是父节点缩放变之后的)

the scale of the node is still doubled by the parent node, however the effective world size is now the same as before because the local scale of the node halves the size again
缩放后的节点依然是父节点的一倍,然后有效的实际距离和以前一样,因为该节点本地缩放大小再次减半


posted on 2011-08-12 11:02  苏桓(osbert)  阅读(188)  评论(0编辑  收藏  举报

导航