page6 Organizing with Node 组织与节点

page6
Organizing with Node  组织与节点
using nodes to organize the scene graph 利用节点组织场景图

the root node in a normal scene 在一个正常场景中的跟节点

like any node it can have other spatials, e.g. nodes as children
像任何节点都能有其他空间体一样,也有子节点

these nodes in turn can have other nodes and spatials as children as well
反言之任何节点也可以有其他节点以及空间作为他的子

this allows organizing the scene graph visually and spatially
这使得场景组织起在视觉上的空间感

一组空间体的移动

but this also allows organizing the scene graph logically
这也使逻辑上组织起场景图

in this case the translations and rotations of the nodes would most probably be zero
这种情况下移动和旋转节点极有可能是零

this way all translation and rotation  values for the children can be used in the same local space
这种方式可以为子对象所有的移动旋转值使用同一个局部空间

but lets go back to the structural overview (the nodes still have zero locations)
但是让我们回到结构概述(节点的位置仍然是零)

when looking for a certain NPC the only spatials we have to look in are the children of the "NPCs" node, e.g.
当仅为寻找某个NPC空间体时,我看到它在“NPCs”节点的子中
Spatial enemy = npcNode.getChild("Enemy");根据名字得到该节点的子空间体

when looking for a mobile object the only spatials we have to look in are the children of the "Mobile" node, e.g.
寻找一个移动对象的唯一空间体,我们要从“Mobile”节点中的子寻找
Spatial enemy = mobileNode.getChild("Enemy");和上个例子一个得到的是同一个对象,因为Mobile节点是NPCs的父

when we want to do e.g. a ray collision check with the world thats easy to, all world objects are grouped in the "Immobile" node.
当我们想做碰撞检测的时候就变得比较简单了,把所有世界对象分组到“不变”节点
CollisionResults results = immobileNode.collideWith(ray);


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

导航