GLScene中 - 转换3D矢量为当前相机矢量 [英] GLScene - convert 3D vector into current camera vector
问题描述
我有X,Y,在3D世界ž载体,我想作出这样的矢量具有相同的方向与当前的相机矢量位置。
I have x,y,z vector in the 3D world and I want to make that vector have the same direction with the current camera vector position.
我用Delphi / GLScene中
I use Delphi/GLScene
推荐答案
如果您希望您的载体,具有相同方向的摄像头,可以简单地使用GLCamera.Direction载体属性。
If you wish for your vector to have the same direction as the camera, you can simply use the GLCamera.Direction vector property.
因此,如如果你的相机正在沿着指向x轴的方向属性为(1,0,0)。你可以使用这个载体,简单复制这些X,Y,Z值,并将其分配给您的x,y,z值的载体。
So, e.g. if your camera is currently pointing along the x axis the Direction property will be (1,0,0). You can use this vector and simply copy these x,y,z values and assign them to your x,y,z values of your vector.
如果您希望相机来查看您的对象。另一方面,GLScene中相机对象有一个名为属性目标对象
将始终将相机对准你的目标。
If on the other hand you wish for the camera to view your object, GLScene Camera object has a property called TargetObject
which will always aim the camera at your object.
Please see the general GLScene help and the GLCamera Reference help
这篇关于GLScene中 - 转换3D矢量为当前相机矢量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!