attaching entities to bones

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

attaching entities to bones

Post by rogerdv » Wed Jan 04, 2012 8:16 pm

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?
0 x

User avatar
chaosavy
Silver Sponsor
Silver Sponsor
Posts: 570
Joined: Mon Jun 15, 2009 8:29 pm
x 5
Contact:

Re: attaching entities to bones

Post by chaosavy » Wed Jan 04, 2012 10:58 pm

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.
0 x
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
Contact:

Re: attaching entities to bones

Post by rogerdv » Wed Jan 04, 2012 11:20 pm

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.
0 x

User avatar
Pyritie
Gnome
Posts: 363
Joined: Wed Feb 25, 2009 6:15 pm
Location: UK
Contact:

Re: attaching entities to bones

Post by Pyritie » Fri Jan 06, 2012 6:10 pm

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
0 x
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

Re: attaching entities to bones

Post by LiMuBei » Mon Jan 09, 2012 11:50 am

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.
0 x

Post Reply