GLScene - 将 3D 矢量转换为当前相机矢量 [英] GLScene - convert 3D vector into current camera vector

查看:28
本文介绍了GLScene - 将 3D 矢量转换为当前相机矢量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 3D 世界中有 x,y,z 矢量,我想让该矢量与当前相机矢量位置具有相同的方向.

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 轴,则 Direction 属性将为 (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 相机对象有一个名为 TargetObject 的属性,该属性将始终将相机对准您的对象.

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.

请参阅一般 GLScene 帮助 和 GLCamera 参考 帮助

Please see the general GLScene help and the GLCamera Reference help

这篇关于GLScene - 将 3D 矢量转换为当前相机矢量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆