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

Can't seem to turn a vector into a rotation?

Asked by
Ghusoc 50
6 years ago

I managed to dig into Roblox's controller modules and created another thumbstick that I'd like to use to rotate the character's waist in the direction you aim, whilst the lower half of the character maintains its original rotation.

My initial problem was to get the waist to rotate only on one axis (I don't have much of an understanding of CFrames). I did manage to solve this, by creating a new CFrame and plugging all 12 components in directly.

if aimVector ~= ZERO_VECTOR3 then
    local x, y, z, r00, r01, r02, r10, r11, r12, r20, r21, r22 = waist.C0:components()

    waist.C0 = CFrame.new(
        waist.C0.x, waist.C0.y, waist.C0.z,
        aimVector.x, r01, r02,
        r10, r11, r12,
        aimVector.z, r21, r22
    )
end

However, the result isn't as expected. You can see what I'm talking about here.

It doesn't always rotate the way you point the thumbstick, and sometimes there's weird glitches with the limbs. Any help would be appreciated, thank you!

1
How about you show all of your code instead of a section of it so we don't assume that something isn't defined in your code? DeceptiveCaster 3761 — 6y

Answer this question