Horde3D http://horde3d.org/forums/ |
|
_cam node http://horde3d.org/forums/viewtopic.php?f=2&t=422 |
Page 1 of 1 |
Author: | PuG [ 16.07.2008, 08:16 ] |
Post subject: | _cam node |
Morning, ive modified one of the samples to load a HordeEditor scene instead of the other content, but im having some trouble with the camera. Im a novice coder and to be honest this isn't my field, so im not sure what im doing at best. At the moment the Camera is added to the Knight Sample Scene using the following: Quote: _cam = Horde3D::addCameraNode( RootNode, "Camera", _hdrPipeRes ); Then some further Camera Setting functions etc defined later on. Ideally I would like to use the Camera from the HordeEditor scene instead, but can't seem to figure out how to render it, and control. I assume I need to define it to the _cam = function (as thats the one rendered later on), but the nodes ive tried such as getNode doesn't obviously work. I assume I need to pick the Camera node defined in the scene xml file. Regards ![]() |
Author: | Volker [ 16.07.2008, 08:30 ] |
Post subject: | Re: _cam node |
If you want to use the camera in the .scene.xml file created by the editor, you have to search for this node after loading the scene in your application. Therefore it is usally a good idea to give the camera a unique name. Then in the application's code you can use Code: int found = Horde3D::findNodes(RootNode, "CameraName", SceneNodeTypes::Camera);
if( found >= 1 ) _cam = Horde3D::getNodeFindResult(0); |
Author: | PuG [ 16.07.2008, 09:04 ] |
Post subject: | Re: _cam node |
Worked a charm, thanks. |
Author: | newbie3D [ 17.07.2008, 04:09 ] |
Post subject: | Re: _cam node |
hi guys, Is there a function that does the collision checking as the one in the SceneEditor (in menu View->Camera collision check)? I set this function in SceneEditor but it has no effect when I load the scene. |
Author: | Volker [ 17.07.2008, 07:28 ] |
Post subject: | Re: _cam node |
That's nothing that is implemented directly in Horde3D. It's only for the editor. But you can use castRay to check for collisions. See also the source code of the editor (cameraNavigationUpdate in GLWidget.cpp). |
Author: | PuG [ 29.10.2008, 20:19 ] |
Post subject: | Re: _cam node |
Just a follow on from this topic - im having a problem where the camera location is not used from the scene.xml file unless I comment out the following from the Main Loop: Code: // Set camera parameters Horde3D::setNodeTransform( _cam, _x, _y, _z, _rx ,_ry, 0, 1, 1, 1 ); However after doing so the camera is positioned correctly (using the position saved in the scene file), it then becomes unmovable from the key controls. Any cut & paste suggestions? ![]() |
Author: | Volker [ 29.10.2008, 21:34 ] |
Post subject: | Re: _cam node |
No cut and paste solution. You have to initialize the _x _y _rx, etc. values with the transformation saved in the XML file. If you comment out the line, you won't change the camera's transformation, so of course it's not possible to control it with the keyboard anymore. |
Author: | PuG [ 29.10.2008, 21:36 ] |
Post subject: | Re: _cam node |
Right thanks, unfortunately that's beyond me. |
Author: | DarkAngel [ 30.10.2008, 00:40 ] |
Post subject: | Re: _cam node |
You could probably use getNodeTransform to initialize the values. Somewhere before the main loop, set a flag to false: Code: bool initCam = false; The replace the "Set camera parameters" code with this: Code: if( !initCam )
{ initCam = true; float foo;//unused - don't care about getting all parameters // Get camera parameters Horde3D::getNodeTransform( _cam, &_x, &_y, &_z, &_rx ,&_ry, &foo, &foo, &foo, &foo ); } else { // Set camera parameters Horde3D::setNodeTransform( _cam, _x, _y, _z, _rx ,_ry, 0, 1, 1, 1 ); } |
Author: | Volker [ 30.10.2008, 08:10 ] |
Post subject: | Re: _cam node |
Thanks for the more detailed description, Darkangel. BTW, you don't really need the foo variable. You could just pass 0 to the method and it won't get those parameters. |
Author: | PuG [ 30.10.2008, 10:12 ] |
Post subject: | Re: _cam node |
Thank you DarkAngel! its working perfect ![]() |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |