set mesh as target for Camera?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
gd_anon
Posts: 98
Joined: Sun Nov 30, 2008 11:03 am
Location: Nowhere

set mesh as target for Camera?

Post by gd_anon »

Can you set a mesh as target for (Maya) camera instead of a 3d point?
Bear_130278
Posts: 237
Joined: Mon Jan 16, 2006 1:18 pm
Location: Odessa,Russian Federation

Post by Bear_130278 »

Witch point of mesh??
The mesh could be just about anything 8)))
Do you like VODKA???
Image
Image
gd_anon
Posts: 98
Joined: Sun Nov 30, 2008 11:03 am
Location: Nowhere

Post by gd_anon »

I mean make the maya camera's target the center of a 3d object instead of a point in 3d space (vector3df)
PS. Sorry for the confusion (and noobyness)
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Post by randomMesh »

If you mean an ISceneNode by Mesh, you could use

Code: Select all

camera->setTarget(node->getAbsolutePosition());
"Whoops..."
DtD
Posts: 264
Joined: Mon Aug 11, 2008 7:05 am
Location: Kansas
Contact:

Post by DtD »

Or if you just want the Maya camera to follow the mesh around, you can probably parent the camera to the node.

~DtD
gd_anon
Posts: 98
Joined: Sun Nov 30, 2008 11:03 am
Location: Nowhere

Post by gd_anon »

If i do that wont the camera's rotation get locked?
And thanks RandomMesh, but yeah if i move the mesh the camera doesnt move with it.
Last edited by gd_anon on Fri Oct 02, 2009 3:51 pm, edited 1 time in total.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

You need to call that function each loop. A better option would be to make an animator which causes the camera to track an object
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
gd_anon
Posts: 98
Joined: Sun Nov 30, 2008 11:03 am
Location: Nowhere

Post by gd_anon »

bitplane wrote:You need to call that function each loop.
Where is that?
(im using the movement code from Irrlicht example 4)
Geomaster
Posts: 71
Joined: Tue Oct 21, 2008 3:39 pm

Post by Geomaster »

It's between 'while (device->run())' and 'videodr->beginScene();'.
gd_anon
Posts: 98
Joined: Sun Nov 30, 2008 11:03 am
Location: Nowhere

Post by gd_anon »

You mean put Camera->setTarget(node->getAbsolutePosition(); between
while(device->run()) and driver->beginScene?
Ive tried that. When i move the object, camera stays (im using movement code from Example 4 like i said)
CuteAlien
Admin
Posts: 9937
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Hm, not sure if that works for maya camera. The point of the maya-cam is that it is user-controlled, so it will probably override any targets you set. Maybe doing an updateAbsolutePosition() after setting it would help, but I haven't tried.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
gd_anon
Posts: 98
Joined: Sun Nov 30, 2008 11:03 am
Location: Nowhere

Post by gd_anon »

It didnt work, too bad. Cause than i would have a 3rd person camera the style i want (rotate it along your character manually).
Edit. Okay ill make a custom one.
Post Reply