Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
0.8.4:cameras [2022/07/20 14:34] – [Smooth Camera Controller] admin | 0.8.4:cameras [2022/07/20 16:02] – [Target] admin | ||
---|---|---|---|
Line 33: | Line 33: | ||
===== Target ===== | ===== Target ===== | ||
- | A very useful property of Firemonkey' | + | A very useful property of Firemonkey' |
You can use this property for easy camera navigation in 3D space. Combine a camera component with a non-visual TDummy instance to navigate. | You can use this property for easy camera navigation in 3D space. Combine a camera component with a non-visual TDummy instance to navigate. | ||
Line 190: | Line 190: | ||
In the following code snippet we modify rotation manually in user-specific mouse events. | In the following code snippet we modify rotation manually in user-specific mouse events. | ||
+ | We're also blocking shifting, because we only want to rotate the camera. | ||
<file pascal> | <file pascal> | ||
Line 223: | Line 224: | ||
GorillaViewport1.OnMouseMove := DoOnViewportMouseMove; | GorillaViewport1.OnMouseMove := DoOnViewportMouseMove; | ||
| | ||
+ | /// Create a smooth camera controller | ||
FCameraCtrl := TGorillaSmoothCameraController.Create(GorillaViewport1); | FCameraCtrl := TGorillaSmoothCameraController.Create(GorillaViewport1); | ||
FCameraCtrl.Parent := GorillaViewport; | FCameraCtrl.Parent := GorillaViewport; | ||
- | FCameraCtrl.Types := []; | + | |
+ | /// NOTICE: Enable only rotation. Disable zooming and shifting | ||
+ | | ||
+ | /// Create our own camera for this controller | ||
FMyCamera := TGorillaCamera.Create(FCameraCtrl); | FMyCamera := TGorillaCamera.Create(FCameraCtrl); | ||
FMyCamera.Parent := FCameraCtrl; | FMyCamera.Parent := FCameraCtrl; | ||
+ | /// Link the camera to the controller | ||
FCameraCtrl.Camera := FMyCamera; | FCameraCtrl.Camera := FMyCamera; | ||
+ | | ||
+ | /// Activate the camera for rendering | ||
+ | GorillaViewport1.Camera := FMyCamera; | ||
+ | GorillaViewport1.UsingDesignCamera := FALSE; | ||
| | ||
[...] | [...] |