zakeIlo
(zakello)
October 13, 2024, 9:19pm
#1
Hello, I’m trying to tween a cframe to a certain spot in between two parts, but I don’t want to use :Lerp() because there is no option for easing style or time, so I’d rather use tween service.
The problem is, I’m trying to set the “CFrame” property of the tween to a spot in between the goal part and the part I am trying to tween, but I’m not sure how to do so.
1 Like
do you mean like the midpoint?
zakeIlo
(zakello)
October 13, 2024, 9:22pm
#3
Any point between 0 and 1.
minimumchars
no no i mean, do you want to get the midpoint of the 2 cframes?
oh wait ik what you mean now
minin
sonic_848
(killer)
October 13, 2024, 9:24pm
#6
You could use lerp, get its halfway point, and then use it as your tween goal
zakeIlo
(zakello)
October 13, 2024, 9:26pm
#7
Does :Lerp() return the CFrame between the two points and the given number?
Use the :Lerp(delta) function and use the return of the function as the tween goal
zakeIlo
(zakello)
October 13, 2024, 9:26pm
#9
For example, if alpha = .15, would it return the CFrame at that point in between the two parts?
yes very true super true ofcourse
zakeIlo
(zakello)
October 13, 2024, 9:27pm
#11
Alright, I’m gonna go ahead and try this out.
sonic_848
(killer)
October 13, 2024, 9:27pm
#12
Yea, it does. The thing is you have to save the cframe so the parts Cframe doesn’t get affected
zakeIlo
(zakello)
October 13, 2024, 9:28pm
#13
So if I put it in to a seperate function and return part.CFrame:Lerp(goalCFrame, alpha)
It’ll return the CFrame value?
sonic_848
(killer)
October 13, 2024, 9:29pm
#14
Yeah, it will. Don’t forget alpha is between 0 to 1 btw
Edit: You don’t need a function for this. You can do it like this:
local Alpha = 0.5
game:GetService("TweenService"):Create(
Part1,
TweenInfo.new(1),
{CFrame = Part1.CFrame:Lerp(Part2.CFrame, Alpha)}
)
zakeIlo
(zakello)
October 13, 2024, 9:39pm
#15
Oh got it, will try this. Just finishing up some code before. I’ll let you know if all works well.
1 Like
system
(system)
Closed
October 27, 2024, 11:13pm
#17
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.