Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,395 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Help..Camera panning RPG #284489
08/13/09 15:29
08/13/09 15:29
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Hello, i've been looking around but nothing came up.

i want to pan the camera like google maps..

You hold the left key, and then move the mouse, and the camera will move the same amount.

I tryed mouse_force, but if it wont work, like i want:
- the mouse speed is not considered and the panning is always +1 because that mouse_force... so if i drag faster it wont move faster.

So my question is. How do i code such thing, so that when i drag from point A to point B, the point will end right over the mouse, and not outside the mouse position.

i tryed mickey.x but that move too fast...

PS:my camera should also mantain a tilt of -58 to the floor.


Thanks..

Re: Help..Camera panning RPG [Re: MMike] #284737
08/14/09 19:25
08/14/09 19:25
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
guys come one, anyone?


function camera_pan(){
camera.tilt=-59; //looking to the ground slightly
while(1){
if(mouse_left){
camera.x+=mickey.y / 69;
camera.y+=mickey.x/87; //this valoues i dont know why are these but there //should be a reason
}

wait(1);}
}


when i move , and grab a point in the ground the point will
move with the mouse, but will past the mouse position, when it must keep the mouse position exaclty.


Last edited by MMike; 08/14/09 19:26.
Re: Help..Camera panning RPG [Re: MMike] #284779
08/14/09 23:32
08/14/09 23:32
Joined: Sep 2008
Posts: 76
Max_Prower Offline
Junior Member
Max_Prower  Offline
Junior Member

Joined: Sep 2008
Posts: 76
Working on it; I'll edit this post when I figure it out. Is what you're looking for a way to change the panning speed depending on how fast you're moving the mouse?

If so, this might help:

Create a variable to handle 'acceleration'. "camera_accel", is an example of a good name. This variable will remain at 0 when you aren't dragging, but will be given a value depending on mouse_force's value.

So if mouse_force == 0 then camera_accel would be 0 as well,

if (mouse_force >= 2 && mouse_force < 4) {camera_accel = 4;}
if (mouse_force <= 2 && mouse_force < -4) {camera_accel = -4;}

Do you get the idea? We're changing the acceleration value based upon the value of mouse_force (how fast we are moving the mouse).

For a basic panning camera:

Some people try something like:

camera.x = mouse_force.x * 5;

That doesn't work, and when you take a look at it the reason is fairly obvious; the camera's x value is going back to zero again because that's the value of mouse_force when the mouse isn't being moved.

The trick is to ADD the mouse_force to the camera.x, not SET camera.x to be equal to mouse_force. You could to it the same way with the keyboard:

if (key_cul == 1) {camera.x -= 5}

That's an example of what I mean.
--------------------------------------
Or: It might simply be because your statements are in a while loop. If you find your movement being really oversensitive, try taking it out of a while loop.


I hope this helped you, bye! ^^

P.S: to PAN the camera in 3DGS often means to turn it as if it's spinning on a pole (with it's z axis), not to pan it across an area like you would in Black and White.

Last edited by Max_Prower; 08/15/09 00:06.
Re: Help..Camera panning RPG [Re: Max_Prower] #285471
08/18/09 17:11
08/18/09 17:11
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
but? your saying mouse_force>=2 ? thats impossible? because mouse_force is just from
-1 to 0 to 1 ?
I dont get it.

That limitation, of mouse force being just 1 to -1 thats the origin of my problems.. because it doesn't account with the speed of it.

And i want to move the camera like Sims for example, but you need to hold left and drag to the camera to mov.. i already got a way of handling this through mouse mickey.. but its not accurate, because, when i press the mouse, at an object, and drag the camera, the object is no longer over the mouse point that was clicked before drag.. (so it lakes speed adjustments).

But the mouse force thing im in doubt? i though it were range 1

Last edited by MMike; 08/18/09 17:28.

Gamestudio download | chip programmers | 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