Model:PivotTo() works before the animation starts playing, even if lines about animation are before PivotTo line

I want to make jumping system off walls, you can also run vertically on them and jump off too

After jump, animation with looped flipping LowerTorso starts playing, and if player was wallrunning upwards, the TimePosition of the animation changes to time where character turned to 180 degrees.

The problem I encountered was that Character changes CFrame BEFORE animation starts playing, even animation fadeTime is set to 0

I tried to put lines about animation before lines about PivotTo function, but it’s still the same

print("oop") -- prints at the start when function calls
CurrentFlipAnimation1 = Animations.FrontFlip
CurrentFlipAnimation2 = Animations.Flips[math.random(#Animations.Flips)]

if DoFlip then

	local Speed = 1
	local LookRaycast = workspace:Raycast(JumpCFrame.Position,JumpCFrame.LookVector * 20,WallParams)

	if LookRaycast and ImpulseType ~= 2 then
		--Speed = 10/((LookRaycast.Distance^2)/10)
		Speed = 3.5 - LookRaycast.Distance/8
	end

	--CurrentFlipAnimation1:Play(0.05,1,Speed * (InvertFlip and -1 or 1))
	CurrentFlipAnimation1:Play(WallRunUp and 0 or 0.05,1,0)

	if WallRunUp then -- checks if player was running upwards
		print("a!")
		CurrentFlipAnimation1.TimePosition = 12/24
	end

	CurrentFlipAnimation2:Play(0.04,0,1)
end
		
		
local JumpCFrame = CFrame.new(HumanoidRootPart.Position)*WallStickCFrame.Rotation		
Character:PivotTo(JumpCFrame * CFrame.Angles(0,(InvertFlip and DoFlip or ImpulseType == 2) and 0 or 0,0)) 
-- 0 or 0 because here I tested if it's really pivotTo starts before animation

This part of code triggers by UserInputService.JumpRequest signal




mb JumpRequest function triggers after Animation render and before SImulation render?

Why do you have a fadeTime of 0.04? Does setting it to 0 fix the issue?

CurrentFlipAnimation2:Play(0.04,0,1)

CurrentFlipAnimation2 is the animation that contains random pose when player does flipping (like random flip tricks). As you see, the Weight (2nd one) property is set to 0. I set to 0 temporarily just so it doesn’t get in the way.
The main animation that rotates lowertorso is CurrentFlipAnimation1

local Animations: {[string]:AnimationTrack} = {
	FrontFlip = Animator:LoadAnimation(AnimationsFolder.General.FrontFlip),
	Flips = {} -- loads animation tracks after by using in pairs() function
}
CurrentFlipAnimation1 = Animations.FrontFlip
CurrentFlipAnimation2 = Animations.Flips[math.random(#Animations.Flips)]

See if task.wait(0.05) helps right before calling PivotTo

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