generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: CFrame animation?

Previous Thread :: Next Thread 
LeitrisArcade is online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
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
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
23 Jul 2014 04:43 PM
I have a lerp animation. It's really smooth.

Report Abuse
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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
LeitrisArcade is online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
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
LeitrisArcade is online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
23 Jul 2014 05:37 PM
bump

( ͡ಠ ͜ʖಠ)
Report Abuse
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
23 Jul 2014 05:55 PM
+ You're welcome.
Report Abuse
LeitrisArcade is online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
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
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
23 Jul 2014 06:00 PM
It's compatible with Parts, not just welds. If you change up the script correctly.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image