Model attachments?
Moderator: InsideQC Admins
16 posts
• Page 1 of 2 • 1, 2
Model attachments?
Just a quick question, is it possible to make an entity have more then one model assigned to it? For instance, I currently have it that I use a different player model for each weapon it holds. This dosn't seem to be very efficient, as each of my player models is about 1.5 mb, and it's a tedious task to export the same character just with different guns rigged onto him. Not to mention I'd have to do the same for my enemy soldier characters, argh. If it is possible, are there good examples of this? 
-

MDave - Posts: 76
- Joined: Mon Dec 17, 2007 7:08 pm
MauveBib wrote:Md3 tagging is your friend.
If only it were so easy. I'm limited by using a quake engine without md3 support, unless I code it in myself somehow. Since this engine isn't exactly on the PC, it might be quite the task to port it
How does quake know .weapon is the model to show for the first person view only, and .model is for the actual character? Is it strictly through the engine only, or QC? Can I do self.model.weapon?
Is there any documentation on how you can pair or link entities together?
-

MDave - Posts: 76
- Joined: Mon Dec 17, 2007 7:08 pm
Not really. It usually becomes easier for us to help you if you can simply tell us what you want to do, rather than asking if your idea of how to do it works. There are many examples of multipart models being done in Quake, they however all use multiple entities for the different parts. Even md3's with tags would do this, unless you use csqc. Prydon Gate is an example of this, separate models for player, weapon and shield. Many visible-weapon mods do this as well.
I was once a Quake modder
-

Urre - Posts: 1109
- Joined: Fri Nov 05, 2004 2:36 am
- Location: Moon
Urre wrote:Not really. It usually becomes easier for us to help you if you can simply tell us what you want to do, rather than asking if your idea of how to do it works. There are many examples of multipart models being done in Quake, they however all use multiple entities for the different parts. Even md3's with tags would do this, unless you use csqc. Prydon Gate is an example of this, separate models for player, weapon and shield. Many visible-weapon mods do this as well.
Hmm, I thought my original post explained with an example what I needed help with. But yeah, a visible weapon mod (for third person view) is what I'm trying to do. When you hold a pistol, the third person model holds a pistol etc. and only the weapon mdl changes, not the entire player mdl too. I'm not too overley familiar with all the mods out there that do this, but I guess the best way to understand how its done is by looking at the qc source right? I thought perhaps it would be simple enough explain how its done in code, guess not.
-

MDave - Posts: 76
- Joined: Mon Dec 17, 2007 7:08 pm
Surely.
Spawn two entities, one for player, another for weapon. In the player's postthink code, do a setorigin on the weapon model to the players origin, and after that make it have the same .angles and same .frame as the player.
Now the tricky part:
All weapons must have the same amount of frames as the playermodel, with the weapon positioned to the players hand, properly aligned and everything, each frame. That takes a little work, but if you're familiar with QME, it shouldn't be hard at all.
This makes the weapon follow the player around, and look as if the player is holding it properly no matter the animation.
Spawn two entities, one for player, another for weapon. In the player's postthink code, do a setorigin on the weapon model to the players origin, and after that make it have the same .angles and same .frame as the player.
Now the tricky part:
All weapons must have the same amount of frames as the playermodel, with the weapon positioned to the players hand, properly aligned and everything, each frame. That takes a little work, but if you're familiar with QME, it shouldn't be hard at all.
This makes the weapon follow the player around, and look as if the player is holding it properly no matter the animation.
I was once a Quake modder
-

Urre - Posts: 1109
- Joined: Fri Nov 05, 2004 2:36 am
- Location: Moon
Urre wrote:That's true, I didn't think about the fact that the third person weapon model will be seen even in first person. This is why Quake Essentials baked their weapons into the playermodel
Heh, I deleted my original post because yours pretty much nailed how it was done.
Anyhow, like I said in the original, just make sure you do it right, and there won't be any problem. Better yet, try to find a way to bake mutiple weapon models into your main player model. (Accessable via different framegroups)
-

Dr. Shadowborg - InsideQC Staff
- Posts: 1110
- Joined: Sat Oct 16, 2004 3:34 pm
Thanks for the helpful replies! Sounds easy enough
Hmm, problem with baking the weapon models into the player would be repeating all the player animations again with each weapon model I have (which is 10, ouch!) so multiply 1.36mb (my player model without a weapon) by 10 and add some more for the extra weapon models, thats one huge file size!
Now for Urre's suggestion I'll only have to worry about the first person view, but is there a way in the engine to fix that, perhaps? Actually, I remmember the chase cam tutorial here doing something funky with hiding the first person view model and displaying the third person view character, even though its not a 'real' chase_active third person camera.
Hmm, problem with baking the weapon models into the player would be repeating all the player animations again with each weapon model I have (which is 10, ouch!) so multiply 1.36mb (my player model without a weapon) by 10 and add some more for the extra weapon models, thats one huge file size!
Now for Urre's suggestion I'll only have to worry about the first person view, but is there a way in the engine to fix that, perhaps? Actually, I remmember the chase cam tutorial here doing something funky with hiding the first person view model and displaying the third person view character, even though its not a 'real' chase_active third person camera.
-

MDave - Posts: 76
- Joined: Mon Dec 17, 2007 7:08 pm
an alternative that i've been messing with is to load up your player model in QME and map the offset and angles of where the weapon would be for each frame straight into qc. tedious, but you don't have to animate your weapons. you'll also have to give the weapon an avelocity to interpolate it if you desire smooth animation. once this is done, you can make as many single frame weapons as you want to attach to the player w/o having to do much work.
-daemon [ daemonforge.org ]
-

daemon - Posts: 63
- Joined: Wed Nov 07, 2007 11:10 pm
daemon wrote:an alternative that i've been messing with is to load up your player model in QME and map the offset and angles of where the weapon would be for each frame straight into qc. tedious, but you don't have to animate your weapons. you'll also have to give the weapon an avelocity to interpolate it if you desire smooth animation. once this is done, you can make as many single frame weapons as you want to attach to the player w/o having to do much work.
One step beyond that is to rig the model with a skeleton. Ok, you need to reanimate the characters again at this point, but it would be a breeze compared to normal in Blender3D. You can rig a armature for weapons then apply each model to it and export appropriately. Every weapon would be rendered based on one animation. (or just import the MDL as an MD2 and animate the weapons using a single armature for each frame of animation. Your option) Then export each weapon with something like the openArena MD3 exporter. After that convert it to MDL using one of the few converting methods out there. It is a bit of work getting the conversion right, but the animation part will be a breeze.
Shoot everything that moves. When it stops moving shoot it again just for good measure.
-

ShoTro - Posts: 61
- Joined: Tue Mar 18, 2008 2:46 pm
- Location: Virginia, USA
Really not that bad, unless you don't know the tools. Then it is a nightmare. XDdaemon wrote:that sounds like some work for each new weapon o.o
Shoot everything that moves. When it stops moving shoot it again just for good measure.
-

ShoTro - Posts: 61
- Joined: Tue Mar 18, 2008 2:46 pm
- Location: Virginia, USA
I have some questions about them too. I've made my models use a lot different attachments and some attachments have attachments too. One character model has total: 4 attachments and 6 subattachments (attachments having attachments). So seeing one character like this brings 11 entities to the screen at once...
Are they going to eat a lot performance?
Are they going to eat a lot performance?
zbang!
-

jim - Posts: 599
- Joined: Fri Aug 05, 2005 2:35 pm
- Location: In The Sun
jim wrote:Are they going to eat a lot performance?
Damn right. Loads of draw calls for that kind of model. This is why UT3 automatically combines attachments into one mesh (except weapon) for example to improve on the performance.
i should not be here
- leileilol
- Posts: 2783
- Joined: Fri Oct 15, 2004 3:23 am
16 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest
