Page 1 of 1

Weapons using player model

Posted: Fri Oct 30, 2015 4:15 am
by ceriux
I really have a few questions is it possible to not assign the player with a model in the usual way? For instance is it okay to set it using set attachment instead? And if so after doing so can i also make weapons show in a similar way? Or do i have to do all of that plus some hacky stuff like still assigning regular models in the regular way but making them invisible on top of doing set attchements?

Also would anyone mind telling me the exact functions needed to make a weapon work? I've looked through qc106 and I can edit it fine. But deciding what functions are exactly required and where to start when coding from scratch is a bit confusing for me.

Lastly do you have to use macros for for animation? Or can i set States and do like

Code: Select all

if (self.state == a )
{
If (time => 0.1)

Self.frame = self.frame + 1;
Else if (self.frame > 6)
Self.frame = 1;
}
I know that code is probably wrong to start with but I'm typing from my phone and honestly haven't done qc in a long time. Hopefully you get where I'm coming from.

Re: Weapons using player model

Posted: Fri Oct 30, 2015 9:13 am
by frag.machine
What exactly are you trying to do ? Using what engine: FTE, Darkplaces, vanilla GlQuake, something else... ? What model format ?

Re: Weapons using player model

Posted: Fri Oct 30, 2015 6:27 pm
by ceriux
set attachments only available using dp and fte i believe. but i plan to use Darkplaces. havent fully decided. basically i want to make my game/mod using scratch code. firstly i want to draw the player model with something like setattachment rather than setting it normally. so that i can make weapons for both first and third person at the same time. ill obviously have to arrange the camera so that it looks as decent as possible. but ill do that using csqc. also i dont like macros... i feel like they're confusing and a waste of time. id rather just set the frame using the number rather than macros... like since i usually make my own models i already know which frames are what i dont need a macro to remind me "hey this is the walk frame" so id rather simplify my animation code if possible.

(yes id like my player to see their feet)

i hope thats a better explanation.

Re: Weapons using player model

Posted: Fri Oct 30, 2015 8:39 pm
by Spike
if you're using csqc, you can put your camera whereever you want, and put the player whereever you want (regardless of where it is in the ssqc).
and yes, if you're using csqc, use only states in ssqc, and have the csqc figure out which frames+lerp factors to use so that the player's feet keep synced with the ground regardless of the actual speed of the player.

Re: Weapons using player model

Posted: Fri Oct 30, 2015 8:59 pm
by ceriux
I don't know if I'll be using csqc to display my players model. I was never able to get a model to actually follow the player when using csqc. It sorta just spawned and sat there. I'll probably just use csqc for hud,ui,and positioning my camera.

Re: Weapons using player model

Posted: Fri Oct 30, 2015 9:14 pm
by frag.machine
About the first question (is it possible to just use setattachment instead assigning a model to the entity ?): my understanding(*) is that setattachment needs to know where you are attaching the model to your entity and usually this information is part of the main model metadata. IIRC one can define such tag data programatically, but unless we are talking about very simple models and animations I wouldn't bother trying this.

(*) Of course, I may be completely wrong :) - because my knowledge is based on how Quake 3 works; because all my attempts to use multipart models always involved 2 or more entities glued with MOVETYPE_FOLLOW and lots of ssqc (exactly the opposite Spike recommended to you); and specially if we are talking about FTE and/or csqc.

Re: Weapons using player model

Posted: Fri Oct 30, 2015 9:16 pm
by frag.machine
About the first question (is it possible to just use setattachment instead assigning a model to the entity ?): my understanding(*) is that setattachment needs to know where you are attaching the model to your entity and usually this information is part of the main model metadata. IIRC one can define such tag data programatically, but unless we are talking about very simple models and animations I wouldn't bother trying this.

(*) Of course, I may be completely wrong :) - because my knowledge is based on how Quake 3 works; because all my attempts to use multipart models always involved 2 or more entities glued with MOVETYPE_FOLLOW and lots of ssqc (exactly the opposite Spike recommended to you); and specially if we are talking about FTE and/or csqc.

Re: Weapons using player model

Posted: Fri Oct 30, 2015 9:19 pm
by frag.machine
(please ignore the double post, my phone hiccupped :P )

Re: Weapons using player model

Posted: Sun Nov 01, 2015 9:58 pm
by drm_wayne
i remember some mod called "super torso" which has exactly that what you want using MD3 models and setattachment.
The md3 models worked as both for 1st and 3rd person (the players view was glued to a md3 tag).

Re: Weapons using player model

Posted: Sun Nov 01, 2015 10:31 pm
by ceriux
ill look into that wayne. i'm just assuming the player is always an enitity and i could just pull cords from the player and have a model follow it. arranging the camera in csqc shouldnt be hard. i'm sure theres a better way than what im thinking to do it and if its in that mod (and i can find the mod) ill do it that way, if im able to understand it anyways..

Re: Weapons using player model

Posted: Wed Nov 11, 2015 6:27 pm
by silverjoel
I added a tag_eyes on the head model and than attached the camera to that. It works out quite nicely, but DP uses the offset of the normal view for height which means water gets a little tricky.

I have a fully functional segmented md3 player model with weapons.