|
From: Peter M. <me...@iw...> - 2001-08-01 12:56:56
|
Hello Luca,
I am also pretty new to the lib, but I had similar questions before.
> 1) Parse the scene graph to find geometry nodes toghether with their
> attributes to perform some basic collision detection.
>
I don't know about collision detection, but here's the code to find a node:
if ((VrmlScene->scope())->findNode("MYTR"))
myTransformNode=((m_pVrmlScene->scope())->findNode("MYTR"))->toTransform();
where MYTR is a DEF in the WRL. In this case it's a transform. In other
cases the last method
is 'toNode()'
> 2) Modify a node attributes and eventually adding and deleting
> dynamically nodes from the world so to "animate" avatars in the world.
>
check out the set field method of the nodetype you want to work with. Give
it what it wants.
In this case I pass a VrmlSFRotation to the rotation field of a transform.
VrmlSFRotation testRot(0.0, 1.0, 0.0, 0.1*m_ms); //x,y,z,rotation
m_pTransformNode->setField("rotation",testRot);
Unfortunately I haven't tried to dynamically add and delete nodes in a
scene. It's easy with nodes
like background, but I don't know how to insert a transform at a certain
point in the scenegraph.
I hope I could help a bit,
Peter
|