Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
1 registered members (AbrahamR), 717 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
Simple Camera #253016
02/22/09 07:33
02/22/09 07:33
Joined: Feb 2009
Posts: 6
Colorado USA
S
snow4dayz Offline OP
Newbie
snow4dayz  Offline OP
Newbie
S

Joined: Feb 2009
Posts: 6
Colorado USA
I hate to start off with such an ignorant question but I am working on a level, I added a camera and I pan and tilt it with this code:

Code:
 if (key_w) camera.tilt += 2 * time_step; 
      if (key_s) camera.tilt -= 2 * time_step; 
      if (key_a) camera.pan += 2 * time_step;
      if (key_d) camera.pan -= 2 * time_step;


Any simple way to make that camera zoom around the map with the W, A, S, D keys? Basically just need to be able to walk-thru the level, however collision would be nice, I am tooling around with c_move as we speak, but still relatively new to the whole process.

-Snow

Re: Simple Camera [Re: snow4dayz] #253023
02/22/09 09:19
02/22/09 09:19
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
What exactly do you want to alter with this WASD keys?
The rotation of the camera (as in your snippet) or the position of it?
Do you have a player model and action which moves through the level?

Re: Simple Camera [Re: Xarthor] #253067
02/22/09 14:03
02/22/09 14:03
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
add your code in main function in while cycle smile


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: Simple Camera [Re: Jaxas] #253097
02/22/09 19:21
02/22/09 19:21
Joined: May 2008
Posts: 10
UK
C
cjm Offline
Newbie
cjm  Offline
Newbie
C

Joined: May 2008
Posts: 10
UK
Just add to the code you are using, if you use the WASD keys for movement you will have to use other keys(or the mouse) for tilting and panning:

Add to main:

while(1)
{
// Tilting and panning code here

if (key_w) camera.x += 2 * time_step; // Adjust 2 factor for right speed!
if (key_s) camera.x -= 2 * time_step;
if (key_d) camera.y += 2 * time_step;
if (key_a) camera.y -= 2 * time_step;

wait(1);
}

Re: Simple Camera [Re: cjm] #253103
02/22/09 20:07
02/22/09 20:07
Joined: Feb 2009
Posts: 6
Colorado USA
S
snow4dayz Offline OP
Newbie
snow4dayz  Offline OP
Newbie
S

Joined: Feb 2009
Posts: 6
Colorado USA
I am kicking myself for not even thinking about the axis call of the camera.. lol, thanks!

Re: Simple Camera [Re: snow4dayz] #253169
02/23/09 09:34
02/23/09 09:34
Joined: Feb 2009
Posts: 6
Colorado USA
S
snow4dayz Offline OP
Newbie
snow4dayz  Offline OP
Newbie
S

Joined: Feb 2009
Posts: 6
Colorado USA
Just FYI, I put the camera code in it's own thread, it's awesome!

Here is a fully functional camera, if anyone ever needs it.

Code:
void camera_move()
{
	while (1)
   {
   	if (key_q) camera.pan += 10 * time_step;
      if (key_e) camera.pan -= 10 * time_step;
      if (key_z) camera.tilt += 10 * time_step;
      if (key_c) camera.tilt -= 10 * time_step;
   	if (key_w) camera.x += 10 * time_step;
		if (key_s) camera.x -= 10 * time_step;
		if (key_d) camera.y += 10 * time_step; 
		if (key_a) camera.y -= 10 * time_step; 
		if (19 == key_lastpressed) // R key will reset the pan and tilt to 0.
      {
         camera.pan = 0;
         camera.tilt = 0;
      }   
   wait (1);
   } 
}


-Snow


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