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?

有帮助吗?

解决方案

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

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

其他提示

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]

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top