Horde3D

Next-Generation Graphics Engine
It is currently 14.05.2024, 05:53

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 06.07.2012, 17:35 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Hello I was stuck on this problem last year and left it because i couldn't proceed.
And now again i am supposed to continue with the same problem.

If I describe my problem in simple words it would be that. i am using

Code:
h3dGetCastRayResult(i, &Intersection_Node, &distance, &intersection))

I am returned with handle of the object in the variable "Intersection_Node" now i want to use this handle for calculating the transformation of the object [e.g wall] using this variable [i.e. Intersection_Node] but the code gives me exception.. I use following function for calculating transformation
Code:
GameEngine::getEntityTransformation(Intersection_Node);

If I use handle to an object obtained by another way and use it in the function. GameEngine::getEntityTransformation(handle) then it calculates me the transformation and it works properly but I have problem calculating the transformation only when I am using the handle obtained through the function h3dGetCastRayResult().
I want to use this h3dGetCastRayResult() function to get the 10 objects close to me in a range and then by this function GameEngine::getEntityTransformation(Intersection_Node); i want to calculate transformation of thos objects through their handles [i.e Intersection_Node].
I have no luck with it and now I want to solve it some how I will appreciate any one's solution.

Thank you


Top
 Profile  
Reply with quote  
PostPosted: 06.07.2012, 18:44 
Offline

Joined: 17.11.2009, 17:00
Posts: 205
Location: Russia, Moscow
Hello imran.
I do not use the gameengine, but it seems that you are trying to use handles, obtained from horde, in gameengine. This will not work because gameengine uses its own handles for entities.

Here is some pseudo code that might help you solve the problem:
Code:

...

GameEntity someGameEngineEntity = getValidEntityFromSomewhere();

H3DNode hordeNode = someGameEngineEntity.entitySceneGraphID();

int numberOfCollisions = h3dCastRay( hordeNode, ..., ..., ...);

H3DNode Intersection_Node = 0;
float distance = 0; float intersection = 0;

for ( unsigned int i = 0; i < numberOfCollisions; ++i )
{
      bool res =  h3dGetCastRayResult(i, &Intersection_Node, &distance, &intersection));
      if ( res )
      {
            unsigned int gameEngineEntity = GameEngine::sceneGraphEntityID( Intersection_Node );
           
            float *nodeTransform = GameEngine::getEntityTransformation( gameEngineEntity );
      }
}



Should be something like that...


Top
 Profile  
Reply with quote  
PostPosted: 16.07.2012, 04:10 
Offline

Joined: 09.02.2011, 17:02
Posts: 83
Irdis wrote:
Hello imran.
I do not use the gameengine, but it seems that you are trying to use handles, obtained from horde, in gameengine. This will not work because gameengine uses its own handles for entities.

Here is some pseudo code that might help you solve the problem:....
....
Should be something like that...


Hello Irdis Thanks for replying and i am sorry that i am writing this late.i saw ur message earlier but i got my official computer on friday
so had to fix it first and today when i used the function that you suggested me i.e
Code:
unsigned int gameEngineEntity = GameEngine::sceneGraphEntityID(Intersection_Node);

then i came accross the following problem.

if i only print the value "gameEngineEntity" then i m getting 0 as printed in the value.
i am getting correct hordeIds in Intersection Node and even if I print Intersection_Node .... I get specific ID .. which is correct

why it converts the Intersection_Node to
"gameEngineEntity" as 0 (zero)

can you suggest something?


Top
 Profile  
Reply with quote  
PostPosted: 16.07.2012, 05:58 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
I guess that the entity is bound to the model while the h3dGetCastRayResult returns an ID of a mesh being a child of this model. So maybe you have to get the model of the mesh returned by h3dGetCastRayResult using h3dGetNodeParent and h3dGetNodeType and try to call GameEngine::sceneGraphEntityID on the model's Horde3D id.

But as I don't know on which Horde3D node you have attached a GameEngine attachment, this is only speculation.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 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