Equipment and hardpoints

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
Stoo
Posts: 42
Joined: 2012-05-11, 00:28

Equipment and hardpoints

Post by Stoo » 2012-07-13, 22:57

I've actually got questions on two topics, but they seem related enough to include in one post -

Equipment:

As I'm working on making an RPG, I'd like to be able to have equipment fill other "slots" on the character (helmet, body armor, boots, etc.) I noticed while reading through the docs that weapon models are created with the portion of the skeleton that they're attached to the pelvis through; is this all that would be needed to render other pieces of equipment? (For instance, a helmet would include the head and spine down to the pelvis?) If I include other body types, do I need to then develop alternate skeletons for all the weapons/equipment that it can use as well? I'll also need to figure out how to include this in the update frames...


Hardpoints:

This is intended to be a largely mech-focused game, and being able to customize players' vehicles is a major theme. I'm hoping to have the vehicles render with different weapons actually visible on the model. I'm also planning to use several different scales and form factors for the mechs, and later have other vehicle types as well - which means that building a skeleton that matches the weapon's potential wielders will become very cumbersome! (Even more so when a given weapon may be equipped in more than one "hardpoint"). I'm not very familiar with the models, and how the renderer handles them - is there a way for the renderer to attach a given weapon model to a particular "hardpoint"? Maybe attach to a particular bone in the vehicle model? Does the renderer even have an awareness of the positions of the bones? Does it make any difference if these weapons won't change while the vehicle entity is "active" on the field?
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Equipment and hardpoints

Post by Carsten » 2012-07-14, 11:16

Stoo wrote:I've actually got questions on two topics, but they seem related enough to include in one post -
Hi, yes, and I answer them "as one": ;-)

The sub/super-model system is quite easy to use and powerful:
It aligns bones in the sub-model with bones of the same name in the super-model.

It doesn't require that the sub-models skeletons begins at the skeleton root of the super-model.
For example, the root bone of a weapon model (the sub-model) could be "right hand", if the player model (the super-model) somewhere has a bone with that name in its body.
Another example, the weapon could have bones like "right shoulder" and "right hand", that would align with the players bones of the same name, but if between shoulder and hand, the player has "upper right arm" and "lower right arm", and the weapon has something else or nothing at all, it would work as well.

This system is very useful, because it combines perfectly well with animations, making sure that the sub- and super-models are always properly aligned and oriented to each other. It is also very easy to use in code.

The most difficult part is probably in the model authoring software, creating the skeletons and assigning proper bone names (the latter can also be renamed and tweaked in the Cafu Model Editor, if required).


About "hardpoints": We don't have exactly something like this at this time, but as a first alternative, I'd explore if the sub-/super-model cannot be used for this purpose. If you want to be able to support multiple attachment points (like "left hand" and "right hand") it would have to be added, but I guess that that would be relatively easy.

As a second alternative, we have "GUI fixtures". They're actually intended to attach GUIs to the models, but I can imagine that they could be used for other purposes as well. ;-)

Only if none of these meet your requirements, I'd suggest to add another explicit feature for naming individual vertices, e.g. for attaching arbitrary items to them for rendering.
Best regards,
Carsten
Stoo
Posts: 42
Joined: 2012-05-11, 00:28

Re: Equipment and hardpoints

Post by Stoo » 2012-07-18, 13:34

Carsten wrote: For example, the root bone of a weapon model (the sub-model) could be "right hand", if the player model (the super-model) somewhere has a bone with that name in its body.
Another example, the weapon could have bones like "right shoulder" and "right hand", that would align with the players bones of the same name, but if between shoulder and hand, the player has "upper right arm" and "lower right arm", and the weapon has something else or nothing at all, it would work as well.
Okay - so to make a pistol that could be wielded in either hand, I'd need two skeletons (and, presumably, two models) - one with a right hand bone, and one with a left; and decide which is appropriate to use (as well as animate each side). On the other hand ( :P ), I can make a rifle with a hand and shoulder bone, and have it wielded at the correct height whether the wielder stands 4 feet or 8 feet tall.
Carsten wrote: About "hardpoints": ... As a second alternative, we have "GUI fixtures". They're actually intended to attach GUIs to the models, but I can imagine that they could be used for other purposes as well. ;-)
I'd forgotten all about the GUI fixtures - they may be exactly what I'm looking for!

What about using an intermediate "adapter" mesh? Vehicles might have a series of hardpoint_1, hardpoint_2, etc. bones, then a series of skeleton-only meshes with a hardpoint_n bone and a mount bone (and no renderable mesh) attaches to each, then each weapon mounts to the mount bone? Or is going to sub-sub-models likely to get hairy?
User avatar
Carsten
Site Admin
Posts: 2160
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Equipment and hardpoints

Post by Carsten » 2012-07-19, 09:32

Stoo wrote:Okay - so to make a pistol that could be wielded in either hand, I'd need two skeletons (and, presumably, two models) - one with a right hand bone, and one with a left; and decide which is appropriate to use (as well as animate each side).
Yes, unless you'd want to play tricks with the bone names in the C++ code.
I cannot recommend this though; never done it myself and don't know if it will work.
On the other hand ( :P )
:cheesy:
What about using an intermediate "adapter" mesh? Vehicles might have a series of hardpoint_1, hardpoint_2, etc. bones, then a series of skeleton-only meshes with a hardpoint_n bone and a mount bone (and no renderable mesh) attaches to each, then each weapon mounts to the mount bone? Or is going to sub-sub-models likely to get hairy?
Never tried it before, but I like the idea, it's a very nice one and better than hacks with bone names!
Submodels are designed to work hierarchically, so this should work immediately (if it doesn't, this would be a bug to be fixed, but either way, I don't see much of a problem here).
Best regards,
Carsten
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests