问题
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