Jump to content
The Dark Mod Forums

Origin Convention for Melee Weapons?


Ishtvan

Recommended Posts

I'm trying to set up some attachment positions like "slung across back," but I noticed the origin of a weapon relative to the hilt/pointy end of a weapon seems to vary a lot. This will also be significant for melee combat later, so I think we should pin this down now.

 

For example, the origin of the hammer is somewhere along the handle, near the hammer end (maybe its center of mass?). The origin of the longsword is right at the end of the hilt, not near the pointy end or near the center of mass. What convention are we using to place the origin of a weapon? Is there one convention that's more common than the others? If so I will define the attachment points with that in mind so that we have to maintain fewer offsets on the less common convention.

 

They are moveables, so that suggets putting the origin at the center to make indirect frobbing work nicely (I don't think it's actually necessary for physics, that calculates the center of mass on its own). However, if we do that, each hilt will be different relative to each center, so that means when you are trying to attach them with the hilt in the AI's hand or at the belt, each one will need a different offset from the origin. :( I guess that's okay, it will just be a lot to maintain.

 

But we should at least be consistent. Will all the weapons have the origin near their center for easy frobbing, like the hammer, or will they be at the hilt for easy attachment, like all the swords/daggers seem to be?

Link to comment
Share on other sites

I changed the hammer one to be closer to the center of mass, because I was noticing very odd behaviour from the swords when they were picked up and thrown--they frequently spun like a top, blade pointing up. I assumed it had something to do with the origin being at the tip of the hilt.

 

If you're certain the origin has nothing to do with then physics, then it would probably make the most sense to put the origin at precisely the point the AI would grip the weapon.

 

Btw, how are these attachment points being set up? Are they relative to a particular joint? I set up the builder hammers with the old system, and spine2 seems to be a decent joint for things on the back.

 

Hips would be most appropriate for things on the belt.

Link to comment
Share on other sites

I changed the hammer one to be closer to the center of mass, because I was noticing very odd behaviour from the swords when they were picked up and thrown--they frequently spun like a top, blade pointing up. I assumed it had something to do with the origin being at the tip of the hilt.

Hmm, I didn't think it mattered for rigid body physics. I could be wrong, but what might be happening is that the actual center of mass really is near the hilt of the sword because the shape of the collision model flares out there. Unfortunately D3 physics isn't good enough to model different densities at different places on a rigid body (like the hammer part vs. the wooden handle), so the center of mass is determined by the volume of the CM. In the case of the sword, it flares out toward the handle, and because it can't be concave, it covers some empty space as well at the handle. So D3 thinks its center of mass is near the handle. I've seen the hammers spin like a top on the hammer part rather than the hilt, which makes sense since the CM flares out near there.

 

The origin matters for indirect frobbing, altho maybe we could alter that code to check distance to center of mass if it's a rigid body. Also, when you pick things up in the grabber, I can't remember if you hold them by the origin or center of mass. I think it's center of mass.

 

Btw, how are these attachment points being set up? Are they relative to a particular joint? I set up the builder hammers with the old system, and spine2 seems to be a decent joint for things on the back.

Yeah, it's relative to joints. I just set up the Builder hammer to be in the same place on Spine2 (it took me a while to realise that that joint was slightly rotated off world axes, argh! :) ).

 

I'm trying to do a point on the hand to replace the "sword" joint now. I guess I'll assume that most weapons will have the origin at the hilt and offset the hammer specifically for now.

Link to comment
Share on other sites

I guess I'll assume that most weapons will have the origin at the hilt and offset the hammer specifically for now.

 

I'll go through the weapons and move the origin point so it is exactly where the AI would be expected to grip the weapon.

 

Yeah, it's relative to joints. I just set up the Builder hammer to be in the same place on Spine2 (it took me a while to realise that that joint was slightly rotated off world axes, argh!

 

One tip--try to make sure the handle of the hammer is off to one side so it doesn't block a player from bjing. I accidently created nearly impervious guards the first time. :)

Link to comment
Share on other sites

Oh, just had a thought...is moving the origin going to have any effect on the first person player animations? I assume the weapons are part of the animation, but better to ask first....

Link to comment
Share on other sites

Whoops, I already put the hammer back exactly the same place it was. :) I can try to move it over. I had to go back and update the code again because I discovered a bug again.

 

@Spring: If you do modify the origins on the weapons, the 'overlap point' I'm defining is the center of the AI's palm. Each entity might still need some fine tweaking, to move it away from the palm a little if the handle is thicker, etc. The longsword was really close as is, just needed a 2 unit offset. I don't think we should try to move the origin to one side of the weapon in the radial direction to make it always even with the surface of the palm, because I think you run into troubles if the origin is outside the model, and you might also run into right hand / left hand or wielding up vs wielding down symmetry issues if it's not radially symmetric.

Link to comment
Share on other sites

Yeah, I agree. I've put the origin pretty much dead center. I've updated all single-handed weapons, including the bows. Didn't change the halberd or spear since we don't have animations to support them yet anyway.

 

Btw, you probably already know this, but I'm updating the hands of our AI, so you might want to make sure you're using either the builder or commoner (the only two with updated hands thus far). The position of the old mitten hands might be slightly different.

Link to comment
Share on other sites

Thanks! I was using the builder. So far I only did the hammer an the longsword as an illustration, I'll update the entity specific offsets once I download your new models with the new origins. I moved the hammer to one side slightly and KO'ing is easier, altho if you approach from that side it can still get in the way. We might have to make stored AI weapons nonsolid to melee attacks for gameplay reasons or something.

 

I wanted to move the attach positions up to AI_humanoid, so that they could easily be inherited if they don't need AI-specific tweaking, but I wasn't sure if all our humanoid AI use the same joint structure? That is, does everyone have a Spine2 joint? I guess I'll at least move up the hand positions, since every humanoid should at least have RightHand and LeftHand joints, right?

 

I might go ahead and do the hip sheath position relative to hips as well. I think it would be good to have a separate position for weapons vs. other stuff on the hips because weapons in a frog are usually slightly angled back.

 

EDIT: I'm also going to modify the code one more time, since I realised that making the attached positions have to be numbered with no gaps is silly once you consider inheritence.

Link to comment
Share on other sites

Okay, I'm done adding a few points. I eventually got stuck on fixing the rotation, so someone with a 3d program can probably do those much faster than me. Documentation for how to do it is here:

http://forums.thedarkmod.com/index.php?showtopic=8070

 

These have been added:

 

Base Humanoid def file (tdm_ai_humanoid):

 

- palm of hand (left/right)

- front-right and front-left of belt

- back-left and back-right of belt

- back-center of belt

 

Builder def file only:

- slung across back (left to right or right to left)

- stacked across back (left to right or right to left). This is offset one unit farther back so that two weapons may be worn crosswise across the back without obvious clipping)

TODO: We can move this to the humanoid base def file, so that other AI can optionally sling swords across the back, but I wasn't sure if all humanoids have Spine2 joint, or is it just the Builder?

 

- Sword at hip (WIP) (I know the builder won't have swords, but wasn't sure if the citywatch mesh was up to date or not). I think the position is okay, but I couldn't get the rotation right by hand. Need a 3d program to generate Euler angles or something.

Link to comment
Share on other sites

Very cool, Ish. :)

 

ODO: We can move this to the humanoid base def file, so that other AI can optionally sling swords across the back, but I wasn't sure if all humanoids have Spine2 joint, or is it just the Builder?

 

 

Most, if not all, humanoids should have Spine2 already. I'll have a go at the sword angles today if I can carve out some free time.

 

These points will still have to be tweaked for individual AI, correct? The distance from the Hip joint to the edge of the belt mesh will vary from AI to AI.

 

Hmm...that reminds me I still have to tweak the position of that one pauldron.... <_<

Link to comment
Share on other sites

These points will still have to be tweaked for individual AI, correct? The distance from the Hip joint to the edge of the belt mesh will vary from AI to AI.

That's right, the attachments will move to match the joints, but any differences in the mesh beyond that have to be accounted for with individual AI offsets from the "standard" attachment positions. I still have to verify that the code for that works and make sure it's parsed in a userfriendly way. Ideally we want the "standard" values in ai_humanoid base to match our most commonly used AI mesh, which might be the citywatch family? It sounded like the Builder was the most up to date though, so I set that up first.

Link to comment
Share on other sites

And here are some screenshots of the attachment-test builder. His friends call him "the Arsenal" :ph34r:

:laugh: I have a hilarious mental picture of a Builder guard dual-wielding hammers now. BUILDER SMAAAASH!

 

Nice work Isht. :)

 

On an unrelated note, those new desert textures are kickin'.

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

:laugh: I have a hilarious mental picture of a Builder guard dual-wielding hammers now. BUILDER SMAAAASH!

Hehe, that can be arranged (with 30 seconds work on the def file). Sorry if these are dark now that I adjusted my gamma/brightness. I brightened up the second one in case it was too hard to see. One of the existing attack animations just happened to look like he was making some kind of badass sign of the crossed hammers.

 

post-40-1217921956_thumb.jpg

post-40-1217921965_thumb.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 7 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...