Getting specific parts of a model

I made a gun in Blender, and I want to be able to simulate shell ejection from a specific part called “dust cover” in Blender. Is there any way to access that part in jme? And if not, is there any other way eject shells from the correct place?

You can attach an empty node to the gun model at the location of the guns barrel, and then at run-time you can get the world translation of that node.

If the gun were rigged and animated, then you could also place an extra bone at the barrel of the gun and use that bone’s attachment node

Some of this will depend on versions, formats, etc.

How do I reference the bone’s attachment node? I’d like to be able to name different parts of the model in Blender, then reference them in jme.

Blender v2.79 (upgrading soon) and JME v3.2.
Using obj right now, but will use GLTF when I upgrade Blender.

If you’re using the old anim system on 3.2 that uses AnimControl and SkeletonControl, then you would want to call some code like this

skeletonControl.getBone("nameOfBone").getAttachmentsNode()

This will return a node that will always be located at that bone and will follow it during animations.
So this would work for placing projectiles at the end of a gun, and is also a great way to dynamically attach weapons and guns to an animated model’s hands.

1 Like

Where do I find the Skeleton to pass as an argument to SkeletonControl?

You don’t. SkeletonControl is either already there or you won’t be able to use it.

Edit: note: OBJ doesn’t support animation so it won’t work for the attachment nodes idea.

Really, your best bet is to upgrade to current versions of things. Then we have something to talk about. Otherwise, get out the duck tape and chicken wire because your going to be in for a good time of bodgying parts together.

1 Like