Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 01:04

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: max dummy objects in H3D
PostPosted: 07.10.2010, 10:30 
Offline

Joined: 07.10.2010, 10:17
Posts: 3
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


Top
 Profile  
Reply with quote  
PostPosted: 07.10.2010, 11:02 
Offline

Joined: 24.03.2010, 10:17
Posts: 55
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


Top
 Profile  
Reply with quote  
PostPosted: 07.10.2010, 16:32 
Offline

Joined: 23.07.2009, 21:03
Posts: 51
Location: Germany
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] );


Top
 Profile  
Reply with quote  
PostPosted: 08.10.2010, 12:15 
Offline

Joined: 07.10.2010, 10:17
Posts: 3
cheers for the help guys. that should do the trick


Top
 Profile  
Reply with quote  
PostPosted: 11.10.2010, 17:15 
Offline

Joined: 07.10.2010, 10:17
Posts: 3
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


Top
 Profile  
Reply with quote  
PostPosted: 11.10.2010, 21:03 
Offline

Joined: 23.07.2009, 21:03
Posts: 51
Location: Germany
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group