Does anyone here know how to detect something dependent on the mouse pos because I’m trying to make a violin bow move from the X Pos for moving the bow from left to right, the Y Pos for the orientation of the bow playing for different strings, and it has nothing to do with the Z position.
==============================================================
Infos, elaborations, and considerations:
An animatable unanchored violin moved by motor 6d, which is a viewmodel, parented into the camera in workspace as a localscript.
No Animation
Idle Animation
I can send you a place file for you if you want me to for helping purposes.
I’m very BAD at cframes and editing motor 6ds so please don’t help me without explaination.
Only problem is I don’t know how to calculate the position, and i don’t think I can move the right arm or the violin bow’s cframe because it’s moved by animation from a motor 6d weld.
Animations edit the transform property so you still can freely modify the C0 in order to change the part1 CFrame which represents the Part1 of the Motor6D which is the right arm in the case.
For further simplicity we can set the Motor6D C1 to CFrame.new() to get rid of it to make the equation simpler.
Part0.CFrame * Motor6D.C0 * Motor6D.Transform = Part1.CFrame *CFrame.new()--CFrame.new() is empty or does nothing therefore....
Part0.CFrame * Motor6D.C0 * Motor6D.Transform = Part1.CFrame
This to conclude to modify the part1 CFrame we can modify the .C0 property.
But how do we modify the C0 property to be dependent on mouse position?
Well you can use CFrame math like @Ty_Scripts taking a property of mouse like mouse position and putting it inside CFrame.new(mouse position) while also having to inverse the Part0 of the CFrame to do it in order to position the right arm in the mouse position like so using this formula to position the Part1 at the mouse position.
motor.C0 = motor.Part0.CFrame:inverse() * CFrame.new(mousePosition)
--Positions the part1 at mouse position
local mouseDelta = --use the service
motor.C0 = motor.C0 *CFrame.new(mouseDelta.X,mouseDelta.Y,0)
In order to mimic arm movement.
Unfortunately, I’m pretty busy and theres there’s way more CFrame math operations we can do. I recommend trying it out or maybe looking at different CFrame projects like an fps framework which also does C0 manipulation to do the view models to get an idea of how to manipulate it. Hope this helps.