Hey developer community,
My idea was to make the arm with a tool face towards where the mouse is in the world position. I already have achieved this using the C0 of the shoulder motor6d. However I want to use transform instead, because this way the walk animation for example would have no impact on where the arm is aiming (Or using lerp I can control how much the walk animation influences where the arm is aiming). Replication for other clients is not my main concern right now.
Here is the code responsible for setting the arms position on this client.
runSer.PreSimulation:Connect(function(delta)
_targetOffset = rightArm.CFrame:ToObjectSpace(CFrame.new(rightArm.Position, mouse.Hit.Position))
char.Torso["Right Shoulder"].Transform = _targetOffset
end
_targetOffset is supposed to be the difference between the current arm CFrame and the target CFrame.
When I run this code without setting the transform at line 3 (So line 3 is commented out), it seems run fine when I print the result. The positions don’t seem to go crazy when I don’t set the transform. However, if the transform is set the arm goes completely crazy and so do the print results.
Here is further visual support:
It is possible that it is something small I missed or I’m just stupid, but I have spent hours trying to fix this so I hope someone can help me with this. If you discourage using motor6d.Transform you can tell as well.
If there are any questions or if I did not explain the matter properly, please tell me.