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
1 registered members (TipmyPip), 18,574 guests, and 6 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
First Person Camera #372986
06/06/11 14:29
06/06/11 14:29
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
Hey Guys, I need help with making a fp camera.
Basically, I have 2 problems:

1: I don't know how to keep the mousepointer in the middle of the screen. With the code from the workshops, it moves faster than the camera.

2: How do you move the camera with a PhysX Collision box?

I am grateful for any help.

Re: First Person Camera [Re: Bennett] #373002
06/06/11 16:22
06/06/11 16:22
Joined: Apr 2011
Posts: 75
Malta
E
Ercoles Offline
Junior Member
Ercoles  Offline
Junior Member
E

Joined: Apr 2011
Posts: 75
Malta
For your first question I also needed to do this in one of my projects and I solved it like this:

mouse_mode=1;
mouse_map = crosshair_pcx;// crosshair image declared before
mouse_pos.x = 649;// place crosshair in centre
mouse_pos.y = 300;// place crosshair in centre
mouse_spot.x = bmap_width(crosshair_pcx)/2;//set mouse pointer hotspot in middle
mouse_spot.y = bmap_height(crosshair_pcx)/2;//set mouse pointer hotspot in middle
while (1)
{
camera.pan -= mouse_force.x*2;
camera.tilt += mouse_force.y*2;
wait(1);
}

I had a 1440*900 resolution screen, so for your case you will need to use other values for mouse_pos.x & mouse_pos.y

Last edited by Ercoles; 06/06/11 16:25.
Re: First Person Camera [Re: Ercoles] #373008
06/06/11 18:01
06/06/11 18:01
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
Thank you very much!

Re: First Person Camera [Re: Bennett] #373010
06/06/11 18:08
06/06/11 18:08
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
okay, so incase anyone is interested: the values for a 1024*764 screen are:
x=490
y=350

Re: First Person Camera [Re: Bennett] #373012
06/06/11 18:16
06/06/11 18:16
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
You can also use

x = screen_size.x/2-bmap_width(crosshair_pcx)/2
y = screen_size.y/2-bmap_height(crosshair_pcx)/2


in order to make it resolution independent.

Re: First Person Camera [Re: the_clown] #373059
06/07/11 09:46
06/07/11 09:46
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
Thank you!


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