About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Gun held by player
Author Message
Harry Offline
Member

Post: #1
Gun held by player
Hi,

I'm curious how in professional games holding guns by player is created that the gun is directed to the centre of the screen.

I'm writing it here because I want get something similar in Esenthel, but I'm not sure how (using code, set animation or something else). What I currently got now is that the bullet is shot in the right direction but it isn't satisfied because in close distance I see that the bullet and the gun don't have the same direction.
02-12-2013 05:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
xzessmedia Offline
Member

Post: #2
RE: Gun held by player
you should take a look into OBJ_CHR or player class in templates / engine header as preffered in the wiki or buy a source from the store, ineisis is a great learning source and is available as 2.0 project

Royality Free Game Ressources
www.xzessmedia.de
(This post was last modified: 02-13-2013 01:36 PM by xzessmedia.)
02-13-2013 01:36 PM
Find all posts by this user Quote this message in a reply
Harry Offline
Member

Post: #3
RE: Gun held by player
Well, maybe I didn't precise what type of weapon I meant. I have firearm in my game and I'd like to have it barrel to point at the same point as crosshair shows. Ineisis doesn't show how can it done easily (only as I remember player can use fireballs - without holding any weapon, but if we treat them like a bullets then I know how I can point them where I want).
02-15-2013 02:10 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #4
RE: Gun held by player
As far as I know, many games use different models for first person and third person views.
In a first person view there, you would make sure your arms + weapon meshes are aligned with the forward (view) axis, even when playing animations (if you need to be able to shoot during those animations)
EDIT: This is the way that Source games work (just to name something): Bullets always go to the middle of the screen (with some randomness), so the animated weapon will always be somewhat pointing in the same direction

Esenthel uses the same models, but the principle is still the same; so try with custom animations. smile

Secondly, but I've never done this, you can also control animation/skeletons through code. This might not be useful to you, but if I ever want ironsights, I'd like to have some random swaying which I can easily increase/decrease (and have the bullet fire along the proper vector too).

You could place an OrientP in the skeleton editor (in front of the barrel), and fire the bullet from that point along the Z axis of that point. You'll still need decent animations then, or you'll be firing all over the place. grin
EDIT: If I'm not mistaken, this is how Red Orchestra 2 does it, you fire from your actual weapon, not the middle of the screen.
(This post was last modified: 02-15-2013 02:31 PM by Tottel.)
02-15-2013 02:29 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #5
RE: Gun held by player
The problem is that when you fire from the actual weapon, the vector from the weapon to the cross-hairs at the center of the screen puts the bullet on a collision for whatever is at the top left or right of the screen.
I don't know how AAA game devs do it, but my trick was to draw the cross-hairs in world space fairly far out, but always in the direction the player is looking. I then make sure it's drawn on 'top' so it can always be seen.

The downside is that close range shooting is wonky.
02-15-2013 08:36 PM
Find all posts by this user Quote this message in a reply
xzessmedia Offline
Member

Post: #6
RE: Gun held by player
what do you mean, a fixed camera and just moving the arms with the gun?
if you want a moving effect, you should move the head faster then the arm slot/bone

Royality Free Game Ressources
www.xzessmedia.de
02-15-2013 11:05 PM
Find all posts by this user Quote this message in a reply
Post Reply