Updating Bone CFrame via Script doesn't actually update the data

Reproduction Steps

Rotating a bone via CFrame property doesn’t seem to update the actual data, In the video here I put an attachment inside of the mech arm (the green dot) and the attachment doesn’t move as the bone is rotating, printing the CFrame also shows the same results

Repro: just import a rig that is using bones instead of motor6D, animate it via script and you’ll notice the data does not update.

Expected Behavior

Bones to actually update CFrame.

Actual Behavior

Rotating a bone via CFrame property doesn’t seem to update the actual data, In the video here I put an attachment inside of the mech arm (the green dot) and the attachment doesn’t move as the bone is rotating, printing the CFrame also shows the same results



Workaround

.

Issue Area: Engine
Issue Type: Other
Impact: Very High
Frequency: Constantly

4 Likes

Bones only update the rendered mesh, they do not affect the transform or collisions or other aspects of instances (aside from CFrame of descendant Bones). And Attachments cannot be parented to Bones, so you can’t put them in the Bone hierarchy.

However, Bones and Attachments are essentially interchangeable in-engine, so anything that can attach to an Attachment (or read/set a property on one) can do the same for a Bone.

So, if your Bone rig already has a Bone where you want the Attachment to be then you can just use that Bone. If the Bone is not in the rig then you can just add it. Or failing that, you can manually calculate the CFrame offset of your Attachment from a relevant Bone in the rig in its rest post, and then every frame at the appropriate time update the WorldCFrame of your Attachment to be Bone.TransformedWorldCFrame * AttachmentOffset.

(Also, I haven’t tried myself so take this idea with a grain of salt, but if you want to be able to move the Bone arbitrarily without affecting the rendered mesh you could in your 3D modelling application try setting the bone’s weight in the rig to 0.)

3 Likes

image

Mk so then here’s the problem:
How the absolute hell, am I supposed to make a full character in a modeling suit, import to Roblox, animate the model in an external program, import animations and use both the model and animations in an actual game if… it doesn’t actually change anything.

Just use motor6ds and creative invisible hitboxes, attach attachments and whatever to those hitboxes? I’m not seeing this as a very intuitive way to actually do anything or if that would even work at all.

1 Like

It’s a bit annoying, but like I said above, it’s not an impossible situation. You can still do all the rig creation and importing as normal (unless you happen to need to add some extra bones to the rig). The only difference is what strategy you use in-engine to get unrelated instances tracking the transformation of the Bones.

You can use Bones as if they were Attachments. So for example you can attach invisible hitboxes to the Bones using RigidConstraints, or you can attach them manually in code by setting their CFrame using the Bones’ transformed CFrame.

Note that it can be a little hard on performance if you have tons of these rigs running around (and in certain scenarios Parts attached to Bones will be much faster than MeshParts attached to Bones).

1 Like

I think I have a similar issue. I have an animation for the character to hold the weapon, but I also cframe rotate the hips as they point with mouse. It would appear the TransformedWorldCFrame of the bone on the weapon for example is not taking into account the cframe rotation of the hips. so when you don’t move the projectile starts in correct location, but when you turn causing hips to move it no longer is. pretty messed up.

1 Like

If this an error on your part, then it could be related to the timing of when you do things relative to the parts of the frame where joint transforms get updated. Here’s some documentation showing when things occur during a frame: Task Scheduler | Roblox Creator Documentation. Might be worth checking what you are doing against that to see if there are any potential issues.

Or perhaps it could just be that the weapon’s bones do not take into account the character’s rig at all, or at least it doesn’t after the initial joint update that sets Transform properties is done (so any changes between that and the time when joint transforms actually get applied are ignored). That could be intentional or a bug.

One band-aid would just be manually applying the rotation to every other joint in the rig (or just the joints you care about).

Anyway, I don’t really have enough information to help you further :slight_smile:

1 Like

thanks I got this working. It was more an issue between moving the rig on server side and then getting the bone location client side. I got this worked out, just needed to keep the location between two server scripts. one that moved the hips and the other that was adding the projectile (or mock projectile).

Thanks for the report! We’ll follow up when we have an update for you.

4 Likes

Any updates on this matter?

(Need filler text)

Any updates? @thirdtakeonit

need more characters to post, also this bug is halting development.

1 Like

Hi, what is the green attachment attached to ?

If possible could I add you to a group chat between my programmer and yourself to answer and questions rather then having me be a middle man for communication as they do not have DevForum access and we’re able to send over the placefile to assist in debugging/reproduction.

Hi GuestCapone, please do, sorry for the wait.