Separating 2 CFrames !HELP NEEDED!

Hello everyone, i am making a system where a platform is aligned with the ground relevant to 4 points,

Enough of than, anyway i have 2 cframes, one that teleports the platform to another platform(lets call it pft2) and a second one that aligns the platform with the ground, the current issue is that i want the cframe that teleports the platform to “ptf2” to be instant and the one that aligns the platform with the ground to be lerped

Here is the code

 local forward = board.Board.CFrame.LookVector
local right = forward:Cross(normal).Unit
local alignedForward = normal:Cross(right).Unit

local position = board.Board.Position
local alignedForward = alignedForward
local normal = normal

local targetNormal = Vector3.new(0, 1, 0)

local lerpedNormal = normal:Lerp(targetNormal, 0.05)

local targetCFrameWithLerpedNormal = CFrame.fromMatrix(position, alignedForward, lerpedNormal) * CFrame.new(0, -0.5, 0)

local interpolatedRotationCFrame = part.CFrame:Lerp(targetCFrameWithLerpedNormal, 0.05)

part.CFrame = CFrame.new(position) * CFrame.new(0, -0.5, 0)
part.CFrame = interpolatedRotationCFrame

The current version is my attempt at solving it, but it doesnt work, ive spent way too much time on this than i’d like to admit

Heres the effect in game(as you can see the skateboard is aligning with the ground but its trailing behind) Skip to 16 sec to see it

Is there a reason you can’t just weld the skateboard model to the character? Or the transparent Part that is already welded to the character? Otherwise, I’m not quite sure what your desired outcome is with the CFrame operations.

Sorry but that wasnt my point, the skateboard model is anchored so i cant weld it to my board, therefore i have to teleport it every frame and also change its orientation based on the ground’s normal vector, but currently both cframes are being lerped so the skateboard is trailing behind, what i want to do is remove the trailing effect, but leave the smooth rotation relative to the ground’s normal
vector

1 Like

Can you try this? Use the .Rotation and .Position to separate the position and rotation from the CFrames.

local positionCFStore = CFrame.new(position) * CFrame.new(0, -0.5, 0)
part.CFrame = interpolatedRotationCFrame.Rotation + positionCFStore.Position
1 Like