I’m working on a “constraint” system for my animation plugin, but I’m having some trouble. What I want to do is make it so that a specific part can act as a part0 by “connecting” a certain part to itself, while also retaining that part’s orientation and original position. The reason I can’t just change the Part0 is because there is data stored that allows a part to interpolate, and changing the part0 completely messes everything up and makes things complicated.
The issue is that I can’t seem to get the target part to retain it’s original position and orientation with respect to its part0, as well as the temporary constraint part. Below is a gif of the problem I’m facing.
In this case (in the video), the magazine is the target part, the left hand of the rig is the constraint part, and the root part of the weapon is the Part0. As stated earlier, the Part0 property of the motor is never changed because it causes too many issues, which leads me to the code I need help with:
local constraint = jDP.constraint -- the part that "acts" as the part0 for a certain amount of time (the left hand)
local kData = posComp * angularComp -- the CFrame data for this joint (which in this case, is the magazine)
comp = data.part0.CFrame:ToObjectSpace(constraint.CFrame) * kData -- this property is applied to the motor's C0
I want to know if it’s possible to have the magazine move with respect to the left hand (the constraint part) without being re-positioned and re-orientated, and if so, how? Keep in mind, all of these parts are assigned to different motors, which means I’m not working with just world space for positioning.
I have tried applying different CFrames to the comp variable, but nothing seems to work (the magazine just ends up in some other weird position and orientation, and does not retain it’s position and orientation with respect to the constraint).
What I ultimately need is a CFrame command that could solve this issue (if one exists). If I left out any important details that could help anybody solve this issue please let me know and I’ll do my best to provide some elaboration, because right now I’m just stuck playing around with the CFrame with no progress.