Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/27/26 22:06
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
2 registered members (AndrewAMD, Quad), 5,104 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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