Basic Camera Without Target

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.
IrrlichtUserNumber1
Posts: 4
Joined: Fri Jun 03, 2011 8:07 pm

Basic Camera Without Target

Post by IrrlichtUserNumber1 »

I have searched around for basic camera without target, but no simple solution found.

I have a camerascenenode added.

Now I want to be able to change the camera position, without camera changing angle...

Is cos sin and similar calculations really needed to rotate camera and move locally???

If so, how?
CondeNostaw
Posts: 20
Joined: Sun Jan 04, 2009 2:47 pm
Location: Brazil

Post by CondeNostaw »

Just change the target as you move the camera.
Obey.
IrrlichtUserNumber1
Posts: 4
Joined: Fri Jun 03, 2011 8:07 pm

Post by IrrlichtUserNumber1 »

I like the fact that you say just...
CondeNostaw
Posts: 20
Joined: Sun Jan 04, 2009 2:47 pm
Location: Brazil

Post by CondeNostaw »

If you know where the camera is supposed to look at, then you know the target. Whatever is changing the camera position can also change its target.

If the camera is translating because its parent is translating, then you can use its parent's transformation to set the target vector.

I can't imagine a scenario where you wouldn't be able to change the target.
Obey.
IrrlichtUserNumber1
Posts: 4
Joined: Fri Jun 03, 2011 8:07 pm

Post by IrrlichtUserNumber1 »

I just want the camera to start at 90 degrees or 0.

Then when I move camera up or left the camera should still look straight ahead.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

We understand completely what you want, and the answer to your problem has already been given...
IrrlichtUserNumber1
Posts: 4
Joined: Fri Jun 03, 2011 8:07 pm

Post by IrrlichtUserNumber1 »

Very helpful post...

That makes it so clear!
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

IrrlichtUserNumber1 wrote:Very helpful post...

That makes it so clear!
So I assume you want to be spoon-fed code (why do any trouble yourself when you can just wait until someone else spoon-feeds you?), while we hold your hand explaining every line character by character right?

As stated before: Your position gets updated, if you want your target to stay at a constant relative offset from your position you just move your target with the same vector as your position was moved with

If that's still too hard, please don't get an attitude towards us and do your homework
Xaryl
Posts: 90
Joined: Sat Apr 30, 2011 11:54 pm

Post by Xaryl »

you can also try

Code: Select all

camera->bindTargetAndRotation(true);
and

Code: Select all

camera->setRotation(startingAngle);
each frame or when the camera moves.
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

Xaryl wrote:you can also try

Code: Select all

camera->bindTargetAndRotation(true);
and

Code: Select all

camera->setRotation(startingAngle);
each frame or when the camera moves.
That doesn't solve the problem. You will still need to update target properly to get proper transform for the camera.

I think OP is thinking of the irrlicht camera as a higher level camera like those in maya, blender etc. The fact of the matter is irrlicht provides an _easier_ abstraction to backends like opengl and d3d. In those environments there isn't a "camera", you have to define a viewspace, using those three essential vectors, up right and at/lookat/forward.

OP, getting the results you want is a simple matter using techniques described to you already. You can also look at the FPS and maya camera animator source files to see how those do it.
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
Xaryl
Posts: 90
Joined: Sat Apr 30, 2011 11:54 pm

Post by Xaryl »

No offence, maybe I am just too sleepy, but that almost feels like a troll post.
However, I will give you the benefit of the doubt and respond.
ChaiRuiPeng wrote:You will still need to update target properly to get proper transform for the camera.
Isn't that the point of binding rotation and target?
Of course, if I am wrong, please explain a little more, I sincerely would like to know my mistakes.
ChaiRuiPeng wrote:I think OP is thinking of the irrlicht camera as a higher level camera like those in maya, blender etc.
I am not really sure how that is inferred from...
IrrlichtUserNumber1 wrote:Now I want to be able to change the camera position, without camera changing angle...
and
IrrlichtUserNumber1 wrote:I just want the camera to start at 90 degrees or 0.

Then when I move camera up or left the camera should still look straight ahead.
ent1ty
Competition winner
Posts: 1106
Joined: Sun Nov 08, 2009 11:09 am

Post by ent1ty »

That call binds rotation to target, but not target to rotation. Yeah, it's incorrectly named.
irrRenderer 1.0
Height2Normal v. 2.1 - convert height maps to normal maps

Step back! I have a void pointer, and I'm not afraid to use it!
IrrlichtUserNumber|
Posts: 2
Joined: Sat Jun 04, 2011 2:05 pm

Post by IrrlichtUserNumber| »

Radikalizm...
Sorry I am not at the level of excellence that you obviously must be, referring to yourself as "we".

It is not a matter of being spoon feed code, I wrote this post because I could not solve the problem I had or did not fully understand the answers.

I have searched around the forum and web like I wrote and the reason I posted replies was because I did not get any response that solved my problem or any link to where it was solved.

I have tried binding target and rotation and I am then able to control rotation of camera, but my problem is that when camera position changes camera rotates to keep looking at target.
I wanted some tips if the need to settarget each time camera moved was the way to go or if I was missing something.

There is a reason why I am posting in beginners thread.
Hope you can just ignore my incompetence.

Great to be regarded as a troll, when needing some help.

But also thanks to those who actually gave me some useful advice.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

It is not a matter of you being a beginner or a matter of not being familiar with all the concepts, everyone is a beginner at some point
It is however a matter of you being given a clear answer to your problem twice which you just completely ignored after which you gave a snappy and arrogant reply
If you do not understand the advice given to you, then don't wait around and get an attitude until someone simplifies it for you, I would have gladly helped you out more if you would have said "Ok, and how would I go about updating my target based on that position transformation then exactly?", that is a valid and good question, ignoring any help you have been given and becoming arrogant however is not going to get you any further
ChaiRuiPeng
Posts: 363
Joined: Thu Dec 16, 2010 8:50 pm
Location: Somewhere in the clouds.. drinking pink lemonade and sunshine..

Post by ChaiRuiPeng »

@Xaryl

That does not solve the problem because it is ROTATION. NOT TRANSLATION. IIRC the at target is in global coords, so it is not enough to simply use bind target to rotation.

Again, I highly suggest OP looking at the source for some of the other cameras like maya and FPS camera. I don't know why you would think this is a troll post, if you haven't noticed we don't really tolerate that kind of stuff here.
ent1ty wrote: success is a matter of concentration and desire
Butler Lampson wrote: all problems in Computer Science can be solved by another level of indirection
at a cost measure in computer resources ;)
Post Reply