Horde3D
http://horde3d.org/forums/

max dummy objects in H3D
http://horde3d.org/forums/viewtopic.php?f=2&t=1270
Page 1 of 1

Author:  Fortune [ 07.10.2010, 10:30 ]
Post subject:  max dummy objects in H3D

Hello Forum :)

So I'm trying a bit of a racing game, and want to use the dummy objects in 3ds max to mark a starting grid, and was wondering if they get through the collada converter ok. I assume finding it would work similar to the particle system attached to the knights sword in the knight demo.

I gave it a go but wasn't sure what nodetype it would be or even if it was possible.

This is what I tried

//adding track node
H3DNode _track = h3dAddNodes(H3DRootNode, trackRes);
h3dSetNodeTransform(_track, 0, 0, 0, 0, 0, 0, 0.01, 0.01, 0.01);

//finding grid position dummy object
h3dFindNodes(_track, "gridPos1", H3DNodeTypes::Mesh);//??????????????????
H3DNode gP = h3dGetNodeFindResult(0);
H3DNode _bike = h3dAddNodes(gP, bikeRes);
h3dSetNodeTransform(_bike, 0, 0, 0, 0, 0, 0, 0.1, 0.1, 0.1);

Although in looking at that, is the bike node is now a child of the grid spot and cannot move around without it.

If someone could help me out with this or has a better way of doing it, that'd be really helpful

Cheers
Fortune

Author:  AlexL [ 07.10.2010, 11:02 ]
Post subject:  Re: max dummy objects in H3D

Hi.
We use dummy nodes as well in order to place instances of other models at certain spots.
So we only had to re-export our "hook" model if we wanted to change a position.
In the knight example the particle system is attached to a joint node, not to a mesh node.
If I remember correctly we had to use at least some dummy mesh geometry, e.g. a cube.
Also during runtime you have to make sure that the dummy mesh node is not visible.
You could assign a special nodraw shader (which is bad if you have a lot of these meshes, as it stresses the culling process).
It's better to replace that dummy node by the actual nodes you want to render.
Hope this helps

Author:  Roland [ 07.10.2010, 16:32 ]
Post subject:  Re: max dummy objects in H3D

I'd suggest putting a dummy mesh, e.g. a cube under your racetrack on the appropriate position.
Just like AlexL suggested.

You can now get the position to set your car to by using:

Code:
//get position of dummy gridPos1
h3dGetNodeTransMats( gridPos1  ,0,  &nodeTrans );
Vec3f pos( nodeTrans[12], nodeTrans[13], nodeTrans[14] );

Author:  Fortune [ 08.10.2010, 12:15 ]
Post subject:  Re: max dummy objects in H3D

cheers for the help guys. that should do the trick

Author:  Fortune [ 11.10.2010, 17:15 ]
Post subject:  Re: max dummy objects in H3D

hi again,

I've had a look and forgive my noobniss can't exactly see how this works.

Mainly unfamiliar with the use of nodeTrans's in Rolands answer.
I assume it would go something like this.

Code:
//finding dummy object gridPos
h3dFindNodes(_track, "gridPos1", H3DNodeTypes::Mesh);
H3DNode gP = h3dGetNodeFindResult(0);

//finding position of gridPos node
h3dGetNodeTransMats(gP, 0, &nodeTrans);
Vec3f pos( nodeTrans[12], nodeTrans[13], nodeTrans[14] );

_bike = h3dAddNodes(H3DRootNode, bikeRes);
h3dSetNodeTransform(_bike, ????, ????, ????, 0, 0, 0, 0.1, 0.1, 0.1);


although without knowing what those nodeTrans's are I'm really only guessing.

Cheers
Fortune

Author:  Roland [ 11.10.2010, 21:03 ]
Post subject:  Re: max dummy objects in H3D

Hi again.
Sorry for my short reply before.
Let me try again :)

Code:
//finding dummy object gridPos
h3dFindNodes(_track, "gridPos1", H3DNodeTypes::Mesh);
H3DNode gP = h3dGetNodeFindResult(0);

//finding position of gridPos node
const float *nodeTrans; //<- sorry :)
h3dGetNodeTransMats(gP, 0, &nodeTrans);
Vec3f pos( nodeTrans[12], nodeTrans[13], nodeTrans[14] );


h3dSetNodeTransform(_bike, pos.x, pos.y, pos.z, 0, 0, 0, 0.1, 0.1, 0.1);



I assume your bike is an individual resource like this:
Code:
H3DRes _bike = h3dAddResource( H3DResTypes::SceneGraph, "models/yellowMonsterBike/yellowMonsterBike.scene.xml", 0 );


and _track something like:
Code:
H3DRes _track = h3dAddResource( H3DResTypes::SceneGraph, "models/racetrack/racetrack.scene.xml", 0 );

This "_track"-scene includes a mesh "gridPos1", which should be defined somewhere in your racetrack.scene.xml (exported from 3ds max)

I hope this helps.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/