Camera Behind Vehicle

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
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Camera Behind Vehicle

Post by mubashar »

How to set camera exactly behind vehicle

In My case Its carNode and its IAnimatedMeshSceneNode ??? and i am using IrrBullet Raycast Vehicle

http://irrlicht.sourceforge.net/forum/v ... =1&t=45529
When it's all over, it's not who you were. It's whether you made a difference
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Camera Behind Vehicle

Post by randomMesh »

The recommended way to do this stuff is to write a custom camera animator. Have a look at the FPS animator and see how it's done.
"Whoops..."
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Camera Behind Vehicle

Post by mubashar »

don't know how to do it can you please elaborate it little more
When it's all over, it's not who you were. It's whether you made a difference
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Camera Behind Vehicle

Post by Granyte »

i don't know about the specific animator but my solution is to

set the came as a child of the node
then set a camera up vector and a camera target vector

and pass them through the node to be folowed matrix
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Camera Behind Vehicle

Post by mubashar »

@grantye plz give me example code
When it's all over, it's not who you were. It's whether you made a difference
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Camera Behind Vehicle

Post by serengeor »

mubashar wrote:don't know how to do it can you please elaborate it little more
erm, look at how other camera animators are implemented (in irrlicht source folder), write one yourself that would do the math to maintain it's possition behind the car scene node? AND read the API doc to figure out what does what..
If you have little knowledge of c++ and OOP, that's another question.
Working on game: Marrbles (Currently stopped).
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Camera Behind Vehicle

Post by mubashar »

@serengeor yeah actually i am thinking there might be some easy way or code available so my time saved .... :( well i can give it try if no alternative solution is there
When it's all over, it's not who you were. It's whether you made a difference
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Camera Behind Vehicle

Post by Granyte »

what i gave you is the easy way the code just need to be called befor a render call
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Camera Behind Vehicle

Post by serengeor »

mubashar wrote:@serengeor yeah actually i am thinking there might be some easy way or code available so my time saved .... :( well i can give it try if no alternative solution is there
Erm, I can't really see how hard and time time consuming can this be.. If you know the basics, it's pretty much +- 1hr of coding depending on how complex you want the movement of the camera to be.

Or you can just update the camera in the main loop.
Working on game: Marrbles (Currently stopped).
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Camera Behind Vehicle

Post by mubashar »

@Granyte applied your solution but camera looks very unnatural ...
When it's all over, it's not who you were. It's whether you made a difference
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Camera Behind Vehicle

Post by serengeor »

mubashar wrote:@Granyte applied your solution but camera looks very unnatural ...
Then do a controller (animator) that would translate to the final position over some time instead of doing it instantly, if that is what you want ofc.
Working on game: Marrbles (Currently stopped).
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: Camera Behind Vehicle

Post by Granyte »

i don't know how you implemented it but on my end it feel like if the camera is ducktaped on the controled object

it's not the most natural camera but it's quick easy and dirty

but if you wan more advanced stuf you will have to learn how to dow it
mubashar
Posts: 63
Joined: Wed Sep 07, 2011 7:20 pm

Re: Camera Behind Vehicle

Post by mubashar »

Successfully implemented much better camera got idea from bullet Vehicle demo its quite nice :)
When it's all over, it's not who you were. It's whether you made a difference
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Camera Behind Vehicle

Post by Mel »

When i have to make a camera move smoothly, i interpolate the original position of the camera target and the intended position of the camera just in the middle, and then, i use that point as the new camera target. The advantage is that the camera moves much more smoothly, the drawback is that if the vehicle moves too fast, it may disappear from the screen, but that only happens with very fast motions, and in most cases, it behaves very well.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Camera Behind Vehicle

Post by hendu »

I find using smooth(er)step makes for very nice camera transitions.
Post Reply