You can write your topic however you want, but you need to answer these questions:
-
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. -
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? -
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!
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