attaching entities to bones

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
User avatar
rogerdv
Gnome
Posts: 351
Joined: Fri May 09, 2003 10:43 pm
Location: Cuba
x 1

attaching entities to bones

Post by rogerdv »

In my game I implemented equipping items to player entity, but I found a problem: most items needed a lot of tweaking to make the item mesh match the entity mesh. Usually finding the correct offset to make a sword looks like being wielded in the hand took me several tries. Can somebody give me an advice about how to reduce this process? Perhaps placing the object at 0,0,0 in the modelling tool (Blender) or something like that?
User avatar
chaosavy
Silver Sponsor
Silver Sponsor
Posts: 578
Joined: Mon Jun 15, 2009 8:29 pm
x 64

Re: attaching entities to bones

Post by chaosavy »

I'm making a mini editor to do this plus more (editing ship xml files eventually, add a gun, add a engine for particles etc), so far I have a very simple add/remove mesh and a add/remove wireframe cube which works for me for positioning to get the offsets you talk about. Eventually plan is to release it as open source.

Also I think there may be some Ogitor or Meshmagic or Meshy or some such around that you could use and yeah Blender would do this as well.
Visit http://www.VoidDestroyer.com to check out my space sim project - Void Destroyer
User avatar
rogerdv
Gnome
Posts: 351
Joined: Fri May 09, 2003 10:43 pm
Location: Cuba
x 1

Re: attaching entities to bones

Post by rogerdv »

I was planning to program a simple item editor to do the work, but a coulpe of weeks ago while playing with unigine I saw that they just define attach points for their high level Character system and the gun is "automagically" attached in the right position. Probably the Unigine guys are doing something I dont know.
User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
x 8

Re: attaching entities to bones

Post by Pyritie »

Make sure the "origin" of your mesh in your model editor is where you want the item to "attach itself". Like on the hilt of a sword or uh... handle? of a gun
I use Mogre, BulletSharp, LuaNetInterface, irrKlang, and Miyagi! | Ponykart (Showcase)
Image
User avatar
LiMuBei
Goblin
Posts: 297
Joined: Mon Jun 09, 2008 3:56 pm
Location: Karlsruhe, Germany
x 10

Re: attaching entities to bones

Post by LiMuBei »

Pyritie wrote:Make sure the "origin" of your mesh in your model editor is where you want the item to "attach itself". Like on the hilt of a sword or uh... handle? of a gun
This. I wanted to attach a weapon to a player character. What I did is create an extra "weapon bone" in the skeleton that can be animated like the weapon should move. Now you only need to model the weapon so that it lines up with the bone. That means the the origin of the mesh will be at the origin of the bone. I also think that the default axis a bone "points to" is the y axis, so the weapon needs either be oriented that way too, or you'll have to manually add an offset rotation.