Page 1 of 1

Weapon Models

Posted: Tue Jun 08, 2010 5:23 pm
by ajay
Is there anything special a model needs to show up as a weapon model. As an example, and not as what I'm doing, if I took a mdl of a chair and wanted it to be a melee weapon, what might stop it showing up, does it need anything special information or positioning etc?

cheers
me

Posted: Tue Jun 08, 2010 5:30 pm
by frag.machine
Just the correct origin/angles offsets, the rest is business as usual. Check all occurrences of, say, "v_axe.mdl" in vanilla source for more details on the QuakeC part.

Posted: Tue Jun 08, 2010 6:14 pm
by Spike
needs specific positioning.
it'll be placed at the player's origin, basically. it'll bob up and down a bit so won't be exactly there, but should be on average. it'll move forwards and back a bit as you look up and down.

less obvious things are that anything closer than 4 quake units to the view will be clipped, and so you will need to position it sufficiently far away from the origin such that the entire model will be visible.
Make it too far away, and it'll clip into walls.
(glquake has a depth hack where the depth of the viewmodel is scaled down by 3, I'm not quite sure on the maths, but keep the model between 4 and 36 units from the origin, I guess (actually, towards the middle of that range due to bob/pitch).
I don't remember which axis the model needs to be on, but it cannot be central. It must be off to one side of the center of the model.
quite a lot of weapon models bug with widescreen or such because they come closer than the 4-unit near-clip plane in areas which would not normally be visible, hence why high fov generally disables the viewmodel entirely.

You can make a model which is a viewmodel in one frame, and a world model in another, yes. But don't expect it to make sense to use the same frames in both situations.

You do still need to precache it.

Posted: Wed Jun 09, 2010 1:03 am
by Sajt
Spike wrote:it'll be placed at the player's origin, basically.
Well, more specifically, the player's view origin (origin + view_ofs).
Spike wrote:it'll move forwards and back a bit as you look up and down.
Only if viewsize is not full (120) or really small, I think (that is, if the sbar "pushes it up"...)