Question

I have a figure at the origin point (0 0 0). So I setup my perspective camera like

<PerspectiveCamera Position="0 0 10" LookDirection="0 0 0" UpDirection="0 1 0" />

But there is nothing to see. How it can be? I look straight to the origin point from my position point!

Only one thing can explain this: the LookDirection is located in the Position's coordinate system (CS), i.e. the Position is the origin point of the local CS in which the LookDirection exists. So the Position is in the global CS, and the LookDirection isn't in the global CS. But I don't meet with that explanation in MSDN. Why they don't tell about that?

Am I right or not?

Was it helpful?

Solution

You should change LookDirection="0 0 0" into LookDirection="0 0 -1"

Check the documentation, LookDirection is a vector, not a location.

OTHER TIPS

You're 10 units on the Z axis, and you want to look at the origin.

You therefore want to look backwards along the Z axis : LookDirection="0 0 -1"

Per Benoit's answer, this field is a vector, not a position.

More generally,

LookDirection = ( LookPosition - CameraPosition ).normalize()

[NB: that's pseudocode, not real code]

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top