how to control two cameras on the same center - Printable Version
+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: how to control two cameras on the same center (/showthread.php?tid=129)
how to control two cameras on the same center - yunus - 07-14-2011
i m trying to use firstPersonCamera and thirdPersonCamera or targatPositionCamera but i cant set them to the same center as position (x,y,z) .
i use firstPersonCamera's events . but after then if i use the other camera's events it doesnt work correctly.I want the new event to work on firstPersonCamera's position.but i can't.Is there any way to control both camera in the same coordinates?
RE: how to control two cameras on the same center - abenedik - 07-18-2011
I am not sure that I fully understand your questions.
I am wondering how do you want to use two cameras - do you have two Viewport3D controls each with its own camera?
Anyway if you would like to change the camera from FirstPersonCamera to TargatPositionCamera you can calculate the TargetPosition with the following:
The CurrentCamera property is the WPF's PerspectivCamera. If it is controlled by the FirstPersonCamera (or any other camera), than the LookDirection vector is not normalized - this way it besides direction it also stores the distance.
You could also use:
Note that you cannot set the TargetPosition for the ThirdPersonCamera, because that camera uses the CenterObject property - it is looking at the center of the specified CenterObject.
You can also use the CurrentCamera property to go from the TargatPositionCamera or ThirdPersonCamera to FirstPersonCamera:
Note that currently the CurrentCamera is always PerspectiveCamera. But this will change in the future because OrthographicCamera will be also supported. Therefore the CurrentCamera will return the basic Camera objects and you will have to make an explicit cast to PerspectiveCamera - for example:
This will make your code more future proof.
I do not understand your question regarding the events. Could you be more specific please.
RE: how to control two cameras on the same center - yunus - 07-19-2011
(07-18-2011, 12:50 PM)yunus Wrote: thank you for suggestions. That works.