GLScene - convert 3D vector into current camera vector

不羁岁月 提交于 2019-12-11 07:56:55

问题


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.

I use Delphi/GLScene


回答1:


If you wish for your vector to have the same direction as the camera, you can simply use the GLCamera.Direction vector property.

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.

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



来源:https://stackoverflow.com/questions/9137587/glscene-convert-3d-vector-into-current-camera-vector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!