Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top