Hi, I have a steering wheel that moves and 2 attachment points on both sides which I hope to be able to attach the player’s hands to.
Any idea on how I might be able to do this?
Cheers,
Hi, I have a steering wheel that moves and 2 attachment points on both sides which I hope to be able to attach the player’s hands to.
Any idea on how I might be able to do this?
Cheers,
You can use @Elocore solution which works.
However, one criticism would be that the IK solution used in that post uses a simple point the shoulders towards the attachments solution, which doesn’t allow for the shoulders to bend naturally though it’s a lot simplistic than the next method.
function handsOnWheel(rightShoulder, leftShoulder)
--Find the positions on the wheel we want the hand to point to
local rightTargetPosition = CFrame.new(rightShoulder.Part0.CFrame:PointToObjectSpace(handRight.WorldPosition)) *(rightShoulder.C0 - rightShoulder.C0.p)
local leftTargetPosition = CFrame.new(leftShoulder.Part0.CFrame:PointToObjectSpace(handLeft.WorldPosition)) *(leftShoulder.C0 - leftShoulder.C0.p)
--Adjust target positions so that the center of the hand will point to target position, otherwise the top left part of the hand will point to target position
rightTargetPosition = rightTargetPosition *CFrame.new(-rightShoulder.Part1.Size.X/2, -rightShoulder.Part1.Size.Y/2, 0)
leftTargetPosition = leftTargetPosition *CFrame.new(leftShoulder.Part1.Size.X/2, -leftShoulder.Part1.Size.Y/2, 0)
--Rotate arms 90 degrees downward so that the end of the hand will point to target position
local rightC0 = CFrame.new(rightShoulder.C0.p, rightTargetPosition.p) *CFrame.Angles(math.rad(90), 0, 0)
local leftC0 = CFrame.new(leftShoulder.C0.p, leftTargetPosition.p) *CFrame.Angles(math.rad(90), 0, 0)
rightShoulder.C0 = rightC0
leftShoulder.C0 = leftC0
end
Or you can use my CCDIK module which requries a lot more setup but you can achieve something cool like what @Defaultio has done, I believe he has done it in the rbxl place file though.
Dude, you are the best. Thanks so much! Have a fantastic day.
Although, I’ve downloaded the place and 2 things,
The arm or leg goes crazy.
Cheers,
or, I downloaded the module but have no idea where to start
nvm, I got it working, except it doesn’t update locally