Hello!
A quick summary:
I’m looking for a way to make a new CFrame with the same orientation as an old one.
I am currently making a mantling system for my game. It works really nicely and smoothly, except you rotate. The problem is, if I don’t rotate it, it doesn’t look very smooth at all - it’s all jittery. I am using CFrame.new
to make the new CFrame, and tweening to it. I’ve also tried CFrame.lookAt
, and the EularAnglesXYZ functions as well. All the other posts about this didn’t work for me.
Here’s a few snippets (indentation is off because of copy and paste from my script):
--[[
"hrp" is the HumanoidRootPart of the player's character.
"ts" is the TweenService.
"camPosMagnitude" is the add factor to keep the camera height the same, I've tried without
]]
local camTween = ts:Create(workspace.CurrentCamera, TweenInfo.new(0.6, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
CFrame = hrp.CFrame + (Vector3.new(0, 5 + camPosMagnitude, 0) + (hrp.CFrame.LookVector * 1.5))
})
--a bit further down the script...
local humTarget = CFrame.lookAt(
currentMantlePos + (hrp.CFrame.Position - hrp.Parent.LeftFoot.CFrame.Position) + Vector3.new(0, addFactor, 0),
hrp.CFrame.Position
)
local tween2 = ts:Create(hrp, TweenInfo.new(0.4, info.EasingStyle, info.EasingDirection), {
CFrame = humTarget
})
local camTween2 = ts:Create(workspace.CurrentCamera, TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
CFrame = humTarget + Vector3.new(0, addFactor, 0)
})
Video showing issue:
TLDR: I’m looking for a way to make a CFrame face the same way as another CFrame.
Any help is appreciated.
I’m still confused so I’m bumping this post