Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get object to mouse rotation in a motor6d?

Asked by
jaschutte 324 Moderation Voter
5 years ago

I have a part with a motor6d infront of the player. I want the part to look at the mouse using C0. Basicly make the part point where ever your mouse is using C0 on a motor6d.

--done in a local script
--Part0 and Part1 are set.
local part = workspace.Part
local x,y,z = CFrame.new(part.Position,mouse.Hit.Position):ToEulerAnglesXYZ()
part.Motor6d.C0 = CFrame.new(0,0,0) * CFrame.Angles(x,0,0)

I've tried CFrame.Angles(y,0,0),CFrame.Angles(z,0,0),CFrame.Angles((x-z),0,0) none seem to work. Someone know what I did wrong? I can't figure this one out.

0
C0 is position, not rotation? BenSBk 781 — 5y
0
C0 is a CFrame jaschutte 324 — 5y
0
And CFrame can contain rotations jaschutte 324 — 5y

Answer this question