Swapping model parts

okay, i tried it and SkeletonControl class is deprecated. is there any workaround that you know about kind sir?

SkeletonControl still functions; it’s deprecated because it’s part of the old (JME 3.2) animation system.

The corresponding class in the new animation system is SkinningControl, and it provides a similar functionality via its getAttachmentsNode() method.

Okay, so i established SkinningControl for playerNode child armature, accessed bone.004, and tried attaching another spatial to it. Doesnt work though. Are there any prerequisites for it to work? Because i couldnt find much information about that. Here are the models and the code:

Can you be more specific?


At least from my basic understanding of what i managed to do up till now, the weapon model should get attached to the attach node of bone.004, but it didnt get attached/ doesnt show up for some reason i dont know about

Your scene is super dark (maybe PBR with no light probe?) but looks like there is a gun there.

what i meant by prerequisites is: does the weapon model itself has to have a bone i need to adress somehow?

No.

yeah the scene is quite dark but there actuallyis some light i made (you can see the textures) and the gun is originally part of the soldier model, and i wanted to attach this model to his left arm for testing purposes

Standard debugging stuff…

Add the weapon to the scene without attaching it to see if it even displays. Or is super small or super big. (We don’t know either)

Then try attaching it to the attachment node thing… and System.out.println() its world position, etc. to see if it’s reasonable.

Yeah, but if it’s exported as GLTF then it will be using the PBR shader… and that will look dark without a light probe because you will never have any ambient light.

Okay, thanks. I will give it a try right now, as i said i am new to gamedev and havent thought about about testing it that way

when i attach the weapon model itself to the rootNode it is perfectly visible, but whenever i attach it to model bone attach node it invisible + its coordinates are always 0,0,0 no matter whether i move the playerNode

Be. More. Specific.

Show. Code.


there is the code responsible for attaching the weapon, moving playerNode, and checking current weapon position

note that the player was continuously moving around so the playerNode coordinates were not 0,0,0

and here’s the result of attaching the weapon to the rootNode

World. Not local. You are printing the local translation which of course won’t change.

https://wiki.jmonkeyengine.org/tutorials/scenegraph/assets/fallback/index.html

I mean, I just looked into my own code and there is nothing special about attachments:

SkinningControl skin = armature.getControl(SkinningControl.class);
skin.getAttachmentsNode("Grip_R").attachChild(sword);

Edit: P.S.: you don’t have to paste screen shots of your code all the time. Makes it a pain to quote.

okay, my bad. Now it works properly.

my bad, too.

so now i know that the weaponSpatial is in fact attached to the player, changes its position when the player moves, changes its position when an animation plays that uses bone.004, but why is it invisible, when , as seen above, it is perfectly visible when attached as a standalone spatial?

Does the world position look sensible? What about the world scale?

Maybe it’s super tiny or off somewhere 100 miles away.

Found it. Thanks a bunch, wouldnt have figured it out by myself