So i'm experimenting with this CFrame and I cant get this object to rotate to the degrees listed below, Ill explain how it works.
--Joint script.Parent.Head.Part0 = script.Parent script.Parent.Head.Part1 = script.Parent.Parent.Parent.Head.BasePart --position Head = script.Parent.Head Head.C0 = CFrame.new( Vector3.new( 0, 2.1 , 0 ) ) --Offset Head = script.Parent.Head Head.C1 = CFrame.new( Vector3.new( 0 , -0.6 , 0 ) ) Head = script.Parent.Head Head.C0 = Head.C0 * CFrame.Angles(math.rad(10),math.rad(70),math.rad(-5))
If I have Head.C0= Head.C0 * this is what happens. It takes its CFrame and continuously adds rads (10,70, -5) to the existing one. So I disable, re-enable and its 10,70,-5, I do it again and it's 20,140,-10, as long as I repeat it, thats what happens.
--Joint script.Parent.Head.Part0 = script.Parent script.Parent.Head.Part1 = script.Parent.Parent.Parent.Head.BasePart --position Head = script.Parent.Head Head.C0 = CFrame.new( Vector3.new( 0, 2.1 , 0 ) ) --Offset Head = script.Parent.Head Head.C1 = CFrame.new( Vector3.new( 0 , -0.6 , 0 ) ) Head = script.Parent.Head Head.C0 = Head.C0 * CFrame.Angles(math.rad(10),math.rad(70),math.rad(-5))
If I have Head.C0= Without the Head.C0 it always stays at 10,70,-5, (which I want). But it's not in the position I want it to be .-. Help please?
I'm not sure if I understand the question exactly, but I believe it's this:
You have three angles describing a rotation
CFrame that you want the Head.C0
to have. You also have a position
that you want the Head.C0
to have.
In that case, it's actually really simple. If rotation
is defined
CFrame.Angles( math.rad(10), math.rad(70), math.rad(-5) )
then it is a CFrame that has a posiiton (p
property) at the origin.
To get that particular rotation to the position we want (Head.C0.p
) we can just add the position to it:
Head.C0 = CFrame.Angles(math.rad(10),math.rad(70),math.rad(-5) ) + Head.C0.p -- Where `Head.Position` is any Vector3 that you want, if you want -- it to move to particular spot -- (using Head.Position will keep it in the same spot)
EDITED: Originally I used Head.Position
, which doesn't make sense since Head
is a snap.
What I meant was the position (.p
) component of Head.C0
, and the script is now updated to reflect that.