Rotate around a Fixed directional axis and not spin

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to rotate my saber around the axis of the direction input into this function. This function calculates the rotation of each CFrame in a continious self made tween.

  2. What is the issue? Include screenshots / videos if possible!
    Right now depending on the direction of where the player looks (Direction) the saber rotates like a drill. Other solutions ive tryed has made it rotate in random ways when doing somthing like a cross. How can I make it so that it rotates like a frizbee along the vector line of travel?

  3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
    The commented out part works perfectly for if I want it to rotate flat in the world. But I want it to do the same thing when I look in any direction. I can’t for the life of me figure it out. ANy help is appreciated. Thanks! :slight_smile:

local spinTarg = math.rad(180)

local function GetRotationPivot(Dt, TweenTime, StartFrame, SpinTarg, PassedTime, RootPart, Direction)
local startOri = StartFrame - StartFrame.Position
– How many spins worth of rotation have passed
local totalSpins = PassedTime / TweenTime

-- Total rotation in radians
local totalRotation = totalSpins * SpinTarg
Direction = Direction.Unit

-- Create the rotation CFrame
--local rotationCFrame = startOri * CFrame.fromAxisAngle(Vector3.new(0, 0, 1), totalRotation) --CFrame.Angles(0, 0, totalRotation)
local rotationCFrame = CFrame.fromAxisAngle(Direction, totalRotation) * startOri

return rotationCFrame, false

end

Just don’t rotate around direction, and rotate perpendicular to it instead.

Thanks. I was trying to do that all day just to find out that the models look and up vectors were mixed up.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.