if IsKeyDown(VK_UP) then DummyCube.Translate(-DummyCube.Position.X, 0,
-DummyCube.Position.Z) else
if IsKeyDown(VK_DOWN) then DummyCube.Translate( DummyCube.Position.X, 0,
DummyCube.Position.Z) else
if IsKeyDown(VK_LEFT) then DummyCube.Translate(-DummyCube.Position.Z, 0,
DummyCube.Position.X) else
if IsKeyDown(VK_RIGHT) then DummyCube.Translate( DummyCube.Position.Z, 0,
-DummyCube.Position.X);
\Lars
From: Silverio Diquigiovanni [mailto:shineworld@users.sf.net]
Sent: 16. december 2016 10:03
To: [glscene:discussion]93606@discussion.glscene.p.re.sf.net
Subject: [glscene:discussion] Panning a scene
Hi to all I'm trying to get a panning of a scene (left/right/up/bottom)
using mouse movements (with righ button pressed).
I'm using Delphi 2006 so related GLScene is version RC 1.0.0.0714.
Actually I can well rotate my scene using this code
// if left mouse changes camera angle (we're moving around the parent and
target dummycube)
if ssLeft in Shift then
Camera.MoveAroundTarget(DY, DX);
The solution seem to move either camera and camera target (the dummybox) left or right how in following code BUT, but, I'm in perspective mode so all 3 axes (X/Y/Z) sould be changed depending by plane inclination...
I don't know how to calculate this ....
Mouse Movement -> DeltaX/Y -> some calc -> Camera/Camera.Target.PositionX/Y/Z = Calculated values...
Last edit: shine world 2017-08-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using an old library so VTS[0] should be changed in new notation VTS.x or something similar
I was not able to get a demo project so I've attached the used code.
Objects name are close to classes name so you shouldn't have problems to guess what are.
The idea is to move either camera and cameratarget of mouse DX/DY.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To have the panning of scene a right way is to move the dummy block linked with camera and related camera in space. Moving the couple is very simple with code attached in my previous post.
I'm amazed about your snapshot.
What are you doing ? Seem a CAD for mech.
I'm very interested on how you had obtained the axis reference XYZ in botton left place !
// if pressed right mouse button moves camera and camera target to get panning in H&V
if (ssRight in Shift)
begin
VT := CameraTarget.Position.AsAffineVector;
VTA := GLScene.Objects.LocalToAbsolute(VT);
VTS := GLSceneViewer.Buffer.WorldToScreen(VTA);
VTS[0] := VTS[0] + DX;
VTS[1] := VTS[1] - DY;
VTW := GLSceneViewer.Buffer.ScreenToWorld(VTS);
CameraTarget.Position.AsAffineVector := VTW;
Camera.Position.AsAffineVector := VectorAdd(Camera.Position.AsAffineVector, VectorSubtract(VTW, VT));
end;
the snapshot is not mine. It's just to take clear my question about panning in csOrthogonal.
i have seen your project. Very, very interesting about your project.
tbk
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi SW,
thank you for the info.
while i am waiting your news, i played with the codes. Now the codes worked for viewers.
i just have problem with one viewer, where only X and Y axes is used.
i dont know where i can fix it.
Any help for me?
tbk
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi to all I'm trying to get a panning of a scene (left/right/up/bottom) using mouse movements (with righ button pressed).
I'm using Delphi 2006 so related GLScene is version RC 1.0.0.0714.
Actually I can well rotate my scene using this code
The camera use csPerspective mode.
Last edit: shine world 2016-12-16
Hi, do something like this:
if IsKeyDown(VK_UP) then DummyCube.Translate(-DummyCube.Position.X, 0,
-DummyCube.Position.Z) else
if IsKeyDown(VK_DOWN) then DummyCube.Translate( DummyCube.Position.X, 0,
DummyCube.Position.Z) else
if IsKeyDown(VK_LEFT) then DummyCube.Translate(-DummyCube.Position.Z, 0,
DummyCube.Position.X) else
if IsKeyDown(VK_RIGHT) then DummyCube.Translate( DummyCube.Position.Z, 0,
-DummyCube.Position.X);
\Lars
From: Silverio Diquigiovanni [mailto:shineworld@users.sf.net]
Sent: 16. december 2016 10:03
To: [glscene:discussion] 93606@discussion.glscene.p.re.sf.net
Subject: [glscene:discussion] Panning a scene
Hi to all I'm trying to get a panning of a scene (left/right/up/bottom)
using mouse movements (with righ button pressed).
I'm using Delphi 2006 so related GLScene is version RC 1.0.0.0714.
Actually I can well rotate my scene using this code
// if left mouse changes camera angle (we're moving around the parent and
target dummycube)
if ssLeft in Shift then
Camera.MoveAroundTarget(DY, DX);
The camera sue csPerspective mode.
http://pasteboard.co/aqR7rv5fe.png
Panning a scene
https://sourceforge.net/p/glscene/discussion/93606/thread/6dbf2dea/?limit=2 5#7817
Sent from sourceforge.net because you indicated interest in
https://sourceforge.net/p/glscene/discussion/93606/
To unsubscribe from further messages, please visit
https://sourceforge.net/auth/subscriptions/
Unfortunately that don't seem to work for me.
The solution seem to move either camera and camera target (the dummybox) left or right how in following code BUT, but, I'm in perspective mode so all 3 axes (X/Y/Z) sould be changed depending by plane inclination...
I don't know how to calculate this ....
Mouse Movement -> DeltaX/Y -> some calc -> Camera/Camera.Target.PositionX/Y/Z = Calculated values...
Last edit: shine world 2017-08-01
I've solved and now I can rotate/zoom/pan a scene with mouse :)
Last edit: shine world 2017-08-01
Hi Silverio,
Can you tell me how you resolved the Panning problem?
Sure Mostafa:
I'm using an old library so VTS[0] should be changed in new notation VTS.x or something similar
I was not able to get a demo project so I've attached the used code.
Objects name are close to classes name so you shouldn't have problems to guess what are.
The idea is to move either camera and cameratarget of mouse DX/DY.
Thank you Silverio,
Hi every one,
A bit late,
my question is how can panning be used in csOrthogonal Camera mode?
i would like to be able to use panning as in this picture.
Thanks
To have the panning of scene a right way is to move the dummy block linked with camera and related camera in space. Moving the couple is very simple with code attached in my previous post.
I'm amazed about your snapshot.
What are you doing ? Seem a CAD for mech.
I'm very interested on how you had obtained the axis reference XYZ in botton left place !
I'm working on a CNC project: you can see my progress on https://www.youtube.com/user/thoth2487/
Hi SW,
do you mean this codes?
the snapshot is not mine. It's just to take clear my question about panning in csOrthogonal.
i have seen your project. Very, very interesting about your project.
tbk
Hi SW,
thank you for the info.
while i am waiting your news, i played with the codes. Now the codes worked for viewers.
i just have problem with one viewer, where only X and Y axes is used.
i dont know where i can fix it.
Any help for me?
tbk