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 » Scripters
Home Search
 

Re: Smooth movement...

Previous Thread :: Next Thread 
ImmortalMiner is not online. ImmortalMiner
Joined: 28 Jun 2011
Total Posts: 658
22 Mar 2015 04:25 PM
How would I get a part to go from one set of coordinates to another without having to spam something like this? I would need it to keep bouncing from a,b,c to x,y,z then back to a,b,c then x,y,z etc.


local shrek = game.Workspace.Part
local a = 0.05
shrek.Position = Vector3.new(CFrame.new(193, 183.8, -324.5))
wait(a)
shrek.Position = Vector3.new(CFrame.new(193, 183.9, -324.5))
wait(a)
shrek.Position = Vector3.new(CFrame.new(193, 184, -324.5))
wait(a)
shrek.Position = Vector3.new(CFrame.new(193, 184.1, -324.5))
wait(a)
shrek.Position = Vector3.new(CFrame.new(193, 184.2, -324.5))
BLAH BLAH BLAH

I don't want to waste my life typing one script... Thanks
Report Abuse
Stefan631 is not online. Stefan631
Joined: 23 Dec 2010
Total Posts: 1350
22 Mar 2015 04:46 PM
local s = workspace.Part;
local times = 10 --change
for i = 0, times, .1 do -- starts at goes up by .1 until it reaches 'times'
s.CFrame = s.CFrame + Vector3.new(0, i, 0);
wait();
end;
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
22 Mar 2015 04:57 PM
if you want to be really fancy, look into sine/cosine, trigonometry, and CFrame interpolation
Report Abuse
ImmortalMiner is not online. ImmortalMiner
Joined: 28 Jun 2011
Total Posts: 658
22 Mar 2015 04:57 PM
local s = game.Workspace.LavaHeights.Lava;
local times = 271.5 --change
for i = 0, times, .01 do -- starts at goes up by .1 until it reaches 'times'
s.CFrame = s.CFrame + Vector3.new(0, i, 0);
wait(0.3);
end;


So 271.5 is the y coordinate I want it to stop at but it just keeps going. Also, the speed at which the part is going upwards accumulates over time... It doesn't stay at a steady rate.
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
22 Mar 2015 05:01 PM
local startPos = Vector3.new(193, 183.8, -324.5)
local endPos = Vector3.new(193, 184.2, -324.5)

for i = 0, 1, 0.02 do
shrek.CFrame = CFrame.new(startPos:lerp(endPos, i))
wait()
end

-- change 0.02 (before 'do') to speed, lower is slower
Report Abuse
ImmortalMiner is not online. ImmortalMiner
Joined: 28 Jun 2011
Total Posts: 658
22 Mar 2015 05:10 PM
Thank you soooo much NotAshley! You're a lifesaver.
Report Abuse
NotAshley is not online. NotAshley
Joined: 16 Jan 2014
Total Posts: 14257
22 Mar 2015 05:11 PM
no problem!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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