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
2 registered members (TipmyPip, 1 invisible), 18,699 guests, and 8 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
Free Camera Select location #260879
04/14/09 11:40
04/14/09 11:40
Joined: Apr 2009
Posts: 10
W
Wayne Offline OP
Newbie
Wayne  Offline OP
Newbie
W

Joined: Apr 2009
Posts: 10
Hi all, I am new to gaming, so sorry if I am missing something very simple here. I am trying to design a 3d room. I have all the models set up with all the textures. I would like to use 1 free camera to navigate around freely, but also have the ability to move to a preconfigured position by pressing 1 through to 9. Has anyone done this before or could anyone advise me where I should be focusing my time.

Am I correct in thinking you can only have 1 free camera per map or can this be achieved by adding several free cameras to different entity’s?

Regards

Wayne

Re: Free Camera Select location [Re: Wayne] #260984
04/15/09 05:24
04/15/09 05:24
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
You can have several cameras in the level at the same time; however, the best solution would be to move the entity that controls the camera at one of your 9 predefined locations as soon as you press the 1...9 keys.

Re: Free Camera Select location [Re: George] #261254
04/16/09 15:03
04/16/09 15:03
Joined: Apr 2009
Posts: 10
W
Wayne Offline OP
Newbie
Wayne  Offline OP
Newbie
W

Joined: Apr 2009
Posts: 10
Cheers George, I have the code working now. I just need to work on rotating the camera when it moves to the set locations
Regards
W

Re: Free Camera Select location [Re: Wayne] #261399
04/17/09 12:54
04/17/09 12:54
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
That's even easier; just rotate the entity that controls the camera in the proper direction like this:

if (location == 1)
{
my_entity.pan = 150; // my_entity is the entity that controls the camera
}

Re: Free Camera Select location [Re: George] #263360
04/29/09 08:56
04/29/09 08:56
Joined: Apr 2009
Posts: 10
W
Wayne Offline OP
Newbie
Wayne  Offline OP
Newbie
W

Joined: Apr 2009
Posts: 10
it worked a treat. I have set it up a slight different way,

var rotation_speed = 20;
var camPos[6][6]; //camera settings, x,y,z, pan, roll, tilt

// Camera pos 1
camPos[0][0] = -282; //x
camPos[0][1] = -111; //y
camPos[0][2] = 116; //z
camPos[0][3] = 66; //camera pan
camPos[0][4] = 0; //camera roll
camPos[0][5] = -45; //camera tilt

// Camera pos 2
camPos[1][0] = -4; //x
camPos[1][1] = 66; //y
camPos[1][2] = -61; //z
camPos[1][3] = 88; //camera pan
camPos[1][4] = 0; //camera roll
camPos[1][5] = -37; //camera tilt

// Camera pos 3
camPos[2][0] = 150; //x
camPos[2][1] = 150; //y
camPos[2][2] = 150; //z
camPos[2][3] = 0; //camera pan
camPos[2][4] = 0; //camera roll
camPos[2][5] = 0; //camera tilt

// Camera pos 4
camPos[3][0] = 150; //x
camPos[3][1] = 100; //y
camPos[3][2] = 70; //z
camPos[3][3] = 0; //camera pan
camPos[3][4] = 0; //camera roll
camPos[3][5] = 0; //camera tilt

// Camera pos 5
camPos[4][0] = 150; //x
camPos[4][1] = 20; //y
camPos[4][2] = 0; //z
camPos[4][3] = 0; //camera pan
camPos[4][4] = 0; //camera roll
camPos[4][5] = 0; //camera tilt

// Camera pos 6
camPos[5][0] = -70; //x
camPos[5][1] = 150; //y
camPos[5][2] = 300; //z
camPos[5][3] = 0; //camera pan
camPos[5][4] = 0; //camera roll
camPos[5][5] = 0; //camera til471t

// main game loop
while(1)
{

if ((7 >= key_lastpressed)&(key_lastpressed > 0))// if the [1 to 6] key is pressed
{
if (camera.x > camPos[key_lastpressed - 2][0]) camera.x -= 1 * time_step;
else if (camera.x < camPos[key_lastpressed - 2][0]) camera.x += 1 * time_step;
if (camera.y > camPos[key_lastpressed - 2][1]) camera.y -= 1 * time_step;
else if (camera.y < camPos[key_lastpressed - 2][1]) camera.y += 1 * time_step;
if (camera.z > camPos[key_lastpressed - 2][2]) camera.z -= 1 * time_step;
else if (camera.z < camPos[key_lastpressed - 2][2]) camera.z += 1 * time_step;
if (camera.pan > camPos[key_lastpressed -2][3]) camera.pan -= 1 * time_step;
else if (camera.pan < camPos[key_lastpressed -2][3]) camera.pan += 1 * time_step;
if (camera.roll > camPos[key_lastpressed -2][4]) camera.roll -= 1 * time_step;
else if (camera.roll < camPos[key_lastpressed -2][4]) camera.roll += 1 * time_step;
if (camera.tilt > camPos[key_lastpressed -2][5]) camera.tilt -= 1 * time_step;
else if (camera.tilt < camPos[key_lastpressed -2][5]) camera.tilt += 1 * time_step;


}

wait (1);
}

Re: Free Camera Select location [Re: Wayne] #263362
04/29/09 08:57
04/29/09 08:57
Joined: Apr 2009
Posts: 10
W
Wayne Offline OP
Newbie
Wayne  Offline OP
Newbie
W

Joined: Apr 2009
Posts: 10
The next thing I am going to try and work on is reading the camera positions from an INI file. and also giving the user the option to store there own camera positions! Now the fun starts again.


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