Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 15,791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
camera synchronized with mouse in isometric views #255180
03/08/09 13:56
03/08/09 13:56
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hi all,

I have only stuff going on on the YZ-Plane and I am looking on it with an isometric view along the X-Axis.

When using a pan-tool, the user moves the screen according to the mouse position by grabbing and dragging the screen. I want this for my app.

My approach so far was the following method:


  • Calculate view volume width and height in quants
  • get mouse movement through mouse_force.x/.y
  • take the ratio of mouse_force to screen_size and multiply it with the view volume width/height
  • add this to camera.x


Here is my code:

Code:
double width = screen_size.x * 2 * tan(camera.arc/2); // From manual
double height = screen_size.y * 2 * tan(camera.arc/2); // Unsure, if this is right

// Calculate movement on Y/Z plane
VECTOR* m = vector(0, (mouse_force.x / screen_size.x) * width, (mouse_force.y / screen_size.y) * height);
vec_scale(m, -1); // Inverse movement to simulate grabbing

vec_add(camera.x, m);


This doesn't work.

Does somebody recognize my error or am I doing everything wrong?

Bye,
Christian

Re: camera synchronized with mouse in isometric views [Re: HeelX] #255189
03/08/09 16:14
03/08/09 16:14
Joined: Mar 2009
Posts: 11
-
T
tehVolcano Offline
Newbie
tehVolcano  Offline
Newbie
T

Joined: Mar 2009
Posts: 11
-
You're missing a while(1) loop. And are you getting errors when starting the application?

Last edited by tehVolcano; 03/08/09 16:17. Reason: I had a question to add.

Gamestudio A7 Pro
Re: camera synchronized with mouse in isometric views [Re: tehVolcano] #255198
03/08/09 17:39
03/08/09 17:39
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
It is of course placed inside a while loop.

I get no errors. The dragging is just not synchronized. When I move the mouse, the cursor is at another position according to the screen image after the drag.

Re: camera synchronized with mouse in isometric views [Re: HeelX] #255394
03/10/09 06:41
03/10/09 06:41
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Although I doubt that this is the problem... did you make sure mouse_mode is on 0 or 1?


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: camera synchronized with mouse in isometric views [Re: KDuke] #255695
03/11/09 22:05
03/11/09 22:05
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Mouse mode is set to 4.

Re: camera synchronized with mouse in isometric views [Re: HeelX] #255712
03/12/09 04:16
03/12/09 04:16
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Huh? mouse_mode set to four? There are only three values for mouse_mode!
That is:
mouse_mode = 0: no mouse pointer but mouse_force is still influenced by the mouse
mouse_mode = 1: mouse is available for clicking and pointing as well as mouse_force is updated by the movement of the mouse
mouse_mode = 2: mouse is available for clicking and pointing but mouse_force is not updated.

If you want to still have the mouse cursor set mouse_mode to 1 otherwise to 0!
That should at least solve the problem that your mouse movement isn't registered.

greetings
KDuke


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: camera synchronized with mouse in isometric views [Re: KDuke] #255721
03/12/09 08:28
03/12/09 08:28
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
@ kduke


0 - mouse pointer inactive / mouse_force is changed by mouse movement (default).
1 - mouse pointer active / mouse_force is also changed by mouse movement.
2 - mouse pointer active / mouse_force is not changed by mouse movement.
4 - mouse pointer active and automatically moved / mouse_force is not changed by mouse movement.

Re: camera synchronized with mouse in isometric views [Re: badapple] #255781
03/12/09 14:51
03/12/09 14:51
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
I just took a quick glance at the manual.
The problem is that mouse_mode 4 is not stated in the german manual compared to the english one.

Anyways... as you can see HeelX in mouse_mode 4 mouse_force isn't changed.


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: camera synchronized with mouse in isometric views [Re: KDuke] #255825
03/12/09 20:06
03/12/09 20:06
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
I checked that too... force is changed in mode 4 even though it says it's not


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1