Camera basics (sorry for bothering)


Sorry for asking some beginner questions :slight_smile:

I searched the forum but could not get the right answer.

I have a question concerning the Camera.

A camera has a location (Vector3f) a left and up Vector (Vector3f) for orientation  of the frustrum box.

But why does it have a direction vector. In my understanding this above infos should be enough?

The direction vector should have only a +/-z Z (0,0,+/-1.0) to describe the direction since the normal vector to the rectangle set up by left and up vector should be the direction.

What I am missing in my thoughts?

Thanks for info

It is true that you can compute one of the three camera axes from the other two, in your case using direction = left.cross(up).  But the engine, definitely does not want to have to do this every frame, so hence the three setter methods.  When computing a camera from non-cardinal axes, you should use the cross product to compute the third vector from the other two known ones in order to keep the axes orthogonal to each other.

Thanks a lot! Did not think at the speed :slight_smile:

But there is another question.

I fiddled around with

Vector3f loc = new Vector3f(300.0f, 30.0f, 0.0f);

cam.lookAt(new Vector3f(100.0f, 0.0f, 0.0f), Vector3f.UNIT_Y);


My box sits at 100,0,0 and I dont see it?

So my cam can't look "behind" it ???

I see the box when x in loc is (x < 100.0f,30.0f,0.0f)

does your Box have a BoundingBox and is your far frustum (view distance) > 200 ?

yes my far frustrum was 1000 and the BoundingBox was set.

you are looking at 100,0,0 from the current camera position(possibly 0,0,0) and then moving the camera to 300,0,0, making the box end up behind you…you need to set location before lookat

yes ! many thanks that is what had happend wrong order :slight_smile: