Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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 | 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