Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 559 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Camera Movement with the mouse #139421
07/04/07 02:57
07/04/07 02:57
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
How would I be able to swivel the camera around with the middle mouse button (by holding down the scroll wheel and dragging the mouse around so that the camera turns around in different directions)
At first I tried using the mickey function, but all this does is zoom in through the z-axis instead of rotating. Would I need the mickey function for this? or is there another function?

Re: Camera Movement with the mouse [Re: Knuckles] #139422
07/04/07 04:33
07/04/07 04:33
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
Probably use vec_set and vec_rotate.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: Camera Movement with the mouse [Re: MrCode] #139423
07/04/07 07:39
07/04/07 07:39
Joined: Apr 2005
Posts: 274
austria
Ascalon Offline
Member
Ascalon  Offline
Member

Joined: Apr 2005
Posts: 274
austria
you have to use mouse_mode = 0, or mouse_mode = 1; if mouse_mode = 2 mouse_force is not changed by mouse movement.

the function for rotating the cam for example:

if(mouse_middle == 1)
{
camera.pan -= mouse_force.x * 5 * time_step; //turn left and right
camera.tilt += mouse_force.y * 5 * time_step; // turn up and down
}


my webside : www.ascalon.jimdo.de
Re: Camera Movement with the mouse [Re: Ascalon] #139424
07/04/07 15:18
07/04/07 15:18
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
Thanks! Now If I want to make it so that the camera swivels smoothly, I would need to adjust the time_step value?

Re: Camera Movement with the mouse [Re: Knuckles] #139425
07/04/07 15:35
07/04/07 15:35
Joined: Apr 2005
Posts: 274
austria
Ascalon Offline
Member
Ascalon  Offline
Member

Joined: Apr 2005
Posts: 274
austria
you have to chance the value before time_step. i took for example a value of "5". if you want it more smooth you have to chance it to a lower value like 3 or 2 or even 0.5. just experiment with different values.


my webside : www.ascalon.jimdo.de
Re: Camera Movement with the mouse [Re: Ascalon] #139426
07/04/07 15:43
07/04/07 15:43
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
or You may try this... speed is depends of mouse distance from center of the screen (if more far from center, the faster turning):

if(mouse_middle == 1)
{
mouse_pos.x = pointer.x; mouse_pos.y = pointer.y;
camera.pan -= (mouse_pos.x - (screen_size.x /2)) * time_step *0.1;
camera.tilt += (mouse_pos.y - (screen_size.y /2)) * time_step *0.1;
}

Play with 0.1 if camera is turning to fast or to slow


Never say never.
Re: Camera Movement with the mouse [Re: tompo] #139427
07/04/07 17:12
07/04/07 17:12
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
ah ok I see it now. Thanks!
I forgot to mention, I wanted it to be able to rotate around the player. Basically the player is like the pivot for the camera.

Re: Camera Movement with the mouse [Re: Knuckles] #139428
07/21/07 09:55
07/21/07 09:55
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
Getting back to this question, I managed to get the camera working, however it won't stay at the spot you drag it to. I've tried everything I can think of to keep the camera in the same place the player moves it to, but it keeps going back to its original location.
At first, I tried on_mouse_middle == 1 but all that happened was that the screen just moved a little when you click the middle mouse button. Then I did the While loop. You can drag the camera around; however, once you let go of the middle mouse button, the camera goes back to its original location rather than stay where the player puts it.
What do I need to do to get this working? it's been bugging me. Thanks in advance.

Re: Camera Movement with the mouse [Re: Knuckles] #139429
07/21/07 13:48
07/21/07 13:48
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
var varcamerapan;

while(mouse_middle == 1)
{
mouse_pos.x = pointer.x; mouse_pos.y = pointer.y;
varcamerapan -= (mouse_pos.x - (screen_size.x /2)) * time_step *0.1;
camera.tilt += (mouse_pos.y - (screen_size.y /2)) * time_step *0.1;

}
while(1)
{
varcamerapan = camera.pan
}

i dont know if it worls but it needs to be somthing like this


"empty"
Re: Camera Movement with the mouse [Re: flits] #139430
07/21/07 23:58
07/21/07 23:58
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
It's still doing the same thing (not staying where the player moves it), but I will work with this as a start, thanks again

Page 1 of 2 1 2

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

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