|
| 23 Jul 2014 04:43 PM |
I've always just used really complicated Motor6D rigs for animation, but Motor6Ds aren't very reliable because they can break. Can anyone point me in the direction where I can learn about CFrame animation, or give an example?
( ͡ಠ ͜ʖಠ) |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2014 04:43 PM |
I have a lerp animation. It's really smooth.
|
|
|
| Report Abuse |
|
|
|
| 23 Jul 2014 04:45 PM |
| It runs on a for i = 0, 1, .1 loop and it will multiply "i" by the angle difference and the start point and end point difference. so if it's 0, it's 0% done with the animation. if it's 0.5, it's 50% done with the animation. And if it's 1, that's basically multiplying it by "1", which is 100% done. |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2014 04:59 PM |
Alright, so I have this and it works, yet I'm only familiar with lerping positions. Would lerping cframe angles and C0s be the way to succesfully animate something?
local Pos1 = Vector3.new(10,10,0) local Pos2 = Vector3.new(20,10,40) local Brick = game.Workspace.TestPart
for ratio = 0,1,0.1 do local NewPosition = Pos1:lerp(Pos2, ratio) Brick.Position = NewPosition wait() end
( ͡ಠ ͜ʖಠ) |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jul 2014 05:54 PM |
function Anim(Weld, Start, End) Weld.C0 = Start --Gotta set it to the start pos first, duh local Angle_Difference = Vector3.new(End:toEularAnglesXYZ()) - Vector3.new(Start:toEularAnglesXYZ()) --So it lerps from the current angle to the new angle for i = 0, 1, .1 do --The higher this is, the faster. All has to add/sum up to "1" local Angle = Vector3.new(Start:toEularAnglesXYZ()) + (Angle_Difference * i) --Keeps adding the angle difference multiplied by "i" until it's finally 100% Part.CFrame = CFrame.new(Start.p + ((End.p - Start.p--[[Position Difference]]) * i)) * CFrame.Angles(Angle.x, Angle.y, Angle.z) end end
local Weld = --Whatever the weld is local Start = Weld.C0 --or C1 local End = CFrame.new(0, 5, 0) * CFrame.Angles(0, math.rad(45), 0) --Supports Rotation too Anim(Weld, Start, End)
Commitment. If it doesn't work, remove all the green tagged words. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Jul 2014 05:57 PM |
Thank you :D. I'll be fiddling with this for a while until I understand what I'm doing.
( ͡ಠ ͜ʖಠ) |
|
|
| Report Abuse |
|
|
|
| 23 Jul 2014 06:00 PM |
| It's compatible with Parts, not just welds. If you change up the script correctly. |
|
|
| Report Abuse |
|
|