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
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 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
Camera Collision Detection #230753
10/08/08 11:29
10/08/08 11:29
Joined: Sep 2008
Posts: 6
W
Wiegje Offline OP
Newbie
Wiegje  Offline OP
Newbie
W

Joined: Sep 2008
Posts: 6
How do I make it so that the camera stays within the bounds of a hallway and not go to the other side of it?

Thanks

Re: Camera Collision Detection [Re: Wiegje] #230775
10/08/08 16:07
10/08/08 16:07
Joined: Dec 2007
Posts: 5
Q
qoolelee Offline
Newbie
qoolelee  Offline
Newbie
Q

Joined: Dec 2007
Posts: 5
Create a small box.mdl, attach the action bellow,
Quote:

action camera_move()
{
var mytemp[3];

while(1)
{
my.pan -= 10 *time_step * mouse_force.x;
my.tilt += 5 * time_step * mouse_force.y;
if(mouse_right || key_w)
{
vec_for_angle(mytemp, my.pan);
vec_scale(mytemp, 10 * time_step);
c_move(me, nullvector, mytemp, GLIDE);
}
if(key_s)
{
vec_for_angle(mytemp, my.pan);
vec_scale(mytemp, -10 * time_step);
c_move(me, nullvector, mytemp, GLIDE);
}
if(key_a)
{
mytemp[0] = cos(my.pan)*cos(my.tilt);
mytemp[1] = sin(my.pan)*cos(my.tilt);
mytemp[2] = 0;
vec_normalize(mytemp, 1);
vec_rotate(mytemp, _vec(90,0,0));
vec_scale(mytemp, 10 * time_step);
c_move(me, nullvector, mytemp, GLIDE);
}
if(key_d)
{
mytemp[0] = cos(my.pan)*cos(my.tilt);
mytemp[1] = sin(my.pan)*cos(my.tilt);
mytemp[2] = 0;
vec_normalize(mytemp, 1);
vec_rotate(mytemp, _vec(-90,0,0));
vec_scale(mytemp, 10 * time_step);
c_move(me, nullvector, mytemp, GLIDE);
}
vec_set(camera.x, my.x);
vec_set(camera.pan, my.pan);


wait(1);
}
}


WASD to move, mouse to pan and tilt.


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