I want to visualize many objects defined with world coordinate.
For example, a cube (1X1X1) at position (1000, 0 , 0), then another cube (2X2X2) at position (0, 1000, 0)...
All the objects are defined only by world coordinates without any translations or rotations.
Now, I want to select an object and let the camera look at the object at any time.
How to do this?
I know Ogre provide OgreBites::CameraMan, but it is based on SceneNode::_getDerivedPosition() that is always (0,0,0) in my case.
Could anyone help me ?
How to set camera manipulater for object defined with world coordinates ?
-
- Gnoblar
- Posts: 9
- Joined: Thu Jun 12, 2014 3:16 am
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
Re: How to set camera manipulater for object defined with world coordinates ?
to look an object you can use SceneNode::lookAt or SceneNode::setDirection, call one of this methods from the scenenode of which the camera is attached to.
cheers!
cheers!
-
- Gnoblar
- Posts: 9
- Joined: Thu Jun 12, 2014 3:16 am
Re: How to set camera manipulater for object defined with world coordinates ?
thank you, xrgo.
I tried your advice. And it worked.
but if I draw mouse (try to watch object from another direction), camera goes back to look at targetNode->_getDerivedPosition().
In other words, the problem is still there.
Could you tell me how you solve the problem together with camera manipulation ?
Or code examples are also good.
I tried your advice. And it worked.
but if I draw mouse (try to watch object from another direction), camera goes back to look at targetNode->_getDerivedPosition().
In other words, the problem is still there.
Could you tell me how you solve the problem together with camera manipulation ?
Or code examples are also good.
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
Re: How to set camera manipulater for object defined with world coordinates ?
ohh I think you want something like an orbit mode? around the object.... that would be a whole different math... I haven't done it but it seems to be that OgreBites::CameraMan has an orbit mode:
https://ogrecave.github.io/ogre/api/1.1 ... a_man.html
https://stackoverflow.com/questions/234 ... on-in-ogre
https://ogrecave.github.io/ogre/api/1.1 ... a_man.html
https://stackoverflow.com/questions/234 ... on-in-ogre