camera += gun

Posted By: Memphis

camera += gun - 08/28/07 19:46

hi this maybe has been brought up in other threads, but i cant find anything useful....

i've been working on a small FPS game, i've run into a problem.... character += camera + gun

ok so thers like 10+ guns, i've played about with
Code:
vec_for_vertex(temp, player, 870);


but it just doesnt look good no matter what i do, i'm trying to make it look like its actually in the players hand, as it will also in the future be multiplayer.

ok so my second option was to create the gun with model of arms... then hide the character + gun from camera view, and show these arms+gun as local entity in the camera, but .genius only supports 1 item if i am correct...

if anyone can give me some sugestions, snippets to examine.. or any other form of help, would be appreciated.

thanks in advance...
Posted By: Scorpion

Re: camera += gun - 08/28/07 20:00

if you want to have the model as a typical FPS, just write:
Code:
vec_set(weapon.x,camera.x);
vec_set(temp,vector(10,2,-5));//play with it
vec_rotate(temp,player.pan);
vec_add(weapon.x,temp);
vec_set(weapon.pan,player.pan);



enjoy
Posted By: Memphis

Re: camera += gun - 08/28/07 20:12

thanks for your response scorpion

ok this kinda would work, if there was no player arm animations, but if the players arm moves, the gun wont position itself to the hand... which i solved using the vec_for_vertex, but still this doesnt look so nice, doesnt actually look like its being held....

take here > http://www.jxp.ca/media/speciaux/unreal5lf7gk.jpg < for example. notice the opponent has hold of a gun, even when the model is animated the gun is still held in its hand. regardless of also weapon switching.... im looking for something in this sort of direction....
Posted By: Nems

Re: camera += gun - 08/28/07 21:29

The easiest (is that a real word?... well it is now!)way is to animate the weapon(each one) with the model then save the file as the 'gun', delete the player, resave without changing the weapons position then use that 'gun' to attach to the player model.
add to the 'gun' scipt, my.Frame = your.frame; my.next_frame = your.next_frame; and the weapon will confrom to the animations as it should do.
Posted By: Metal_Man

Re: camera += gun - 08/29/07 02:09

if you are using vec_for_vertex, are you using other vertecies to determine the rotation of the weapon? you would need two extra verticies to determine the rotation. one to point it in the right direction and another to prevent it from spinning oddly.

this is even easier than animating each weapon because it means that less animations are requiured, one set of animations in the hands would suffice. Also, you wouldn't have to change animations of several models to change or add new animations.

to take care of weapon switching, edit the model in MED to move the whole thing such that the center of the model is at the position you wish for it to be held at.
Posted By: Memphis

Re: camera += gun - 08/29/07 08:53

hi, thanks for your replies... ok

Nemisis : the problem with this solution is, if there is say 20 models and 20 different guns, thats alot of animation lol.... but thanks it is one option...

Metal_Man : yes i calculate the movement of the player to position the gun, but still it jus doesnt look right, it seems you are able to see through the player and see the gun, even tho the player is in front of the gun, very odd....

i guess to model the arms with each gun, probably is best way around this...

but is it possible to hide the player and a model of the gun locally, so multiplayer can see the vec_for_vertex method, and the player can see the arms with gun model ?

thanks in advance.
Posted By: Scorpion

Re: camera += gun - 08/29/07 12:24

yeah...there is something as ent_reatelocal....

to add to a vertex and rotate it by a second vertex is also really easy:

Code:
vec_for_vertex(temp,player,1234);
vec_set(weapon.x,temp);
vec_for_vertex(target,player,1235);
vec_sub(target,temp);//Get the direction
vec_to_angle(weapon.pan,target);


Posted By: Memphis

Re: camera += gun - 08/29/07 16:19

hi thanks, yep i know of ent_createlocal, which is fine for creating the arms... but for camera hiding the player and gun ie like

camera.genius = player

i need also todo this with the gun model

thanks.
Posted By: Metal_Man

Re: camera += gun - 08/29/07 17:14

seeing the gun through another object is a skin problem. try turning off the alpha setting for the player's skin
Posted By: Memphis

Re: camera += gun - 08/29/07 19:15

hi, ok i couldnt find anything with the alpha settings that would of affects this, ok i've made a quick example of what is happening, i havent positioned gun to hand, ive moved the gun in front of player and this is what happens:




Posted By: Memphis

Re: camera += gun - 08/29/07 20:42

hi ok i've solved my problem.

i removed

Code:
gun1.flags = VISIBLE;

the gun is still visible, and it shows now in front of player, thanks anyways for help.
Posted By: Memphis

Re: camera += gun - 08/31/07 22:12

hi again lol ... is there a way to remove visibilty for the gun and the player but only locally, keep visibilty for multiplayer users... ?

i know camera.genius = player, but what about the gun?

thanks in advance.
© 2024 lite-C Forums