Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
moving gun #254118
03/01/09 10:31
03/01/09 10:31
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
please can someone help me
i want in my fps that the gun follows the crosshair
pleeeease blush

Re: moving gun [Re: GameScore] #268045
05/27/09 10:35
05/27/09 10:35
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
hopfel Offline
User
hopfel  Offline
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
in the tutorial in the book is there:

gun.pan= (mouse_pos.x - screen_size.x /2) /-10;
gun.tilt= (screen_size.y /2 - mouse_pos.y) /-10;

but it's not very exact....


Hilf mir, dir zu helfen!
Re: moving gun [Re: hopfel] #268055
05/27/09 11:11
05/27/09 11:11
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
So simple, no need for an example.
If the camera is moving, put the crosshair in a PANEL*, and then execute shooting function.

Re: moving gun [Re: Cowabanga] #268389
05/28/09 23:06
05/28/09 23:06
Joined: May 2009
Posts: 258
Chicago
J
Jaeger Offline
Member
Jaeger  Offline
Member
J

Joined: May 2009
Posts: 258
Chicago
Ehhh... Why don't you just take your gun model (with or without player's hands), and use code to set it off to the right side of the screen? Then make the crosshair stay dead center the whole time, right in the middle of the screen. Then your gun model/hands pan with the camera everywhere you look. That's how it's done in almost every fps game. Watch some Youtube videos of other fps games, and you'll see exactly what I mean...

To make things easy, if you don't want to use any Trig to calculate the y-axis distance the gun has to stay from the center of the screen, you could even use vec_for_vertex, and set a constantly updating vector from a vertex on your character model. Then you just add or subtract the offset from that. This is pretty easy stuff, bro. If you don't get what I mean, you should really check the manuals and do the Lite-C workshops. If you prefer C-Script (yuck), you can easily find hundreds of tutorials on that.


Moderated by  HeelX, rvL_eXile 

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