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
3 registered members (Grant, TipmyPip, AndrewAMD), 12,724 guests, and 5 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
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 | 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