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: Moving entire models from point A to point B

Previous Thread :: Next Thread 
BobCowMan is not online. BobCowMan
Joined: 14 May 2010
Total Posts: 22634
04 Jan 2016 04:45 PM
I want a model car to gradually move from point A to point B like it's driving there

Obviously it's easy to do this with a single part, but I've never tried this with a complete model

Any help/tips?


3:8 BCM / Speedyseat(co-owner)
Report Abuse
Gragon387 is not online. Gragon387
Joined: 02 Jan 2011
Total Posts: 200
04 Jan 2016 04:52 PM
Usually to move a model from point A to point B you would need to move the Humanoid... so... Try to make your car a Humanoid maybe?
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
04 Jan 2016 04:54 PM
:MoveTo(Vector3) works on models as well..
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
04 Jan 2016 04:55 PM
MoveTo can be used on models, sure. I think it'd be way easier to just set the primary part and use lerps, though.
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
04 Jan 2016 04:56 PM
never mind, just MoveTo is necessary
I wasn't aware Lerp was a property of both Vector3's and CFrame's.
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
04 Jan 2016 04:58 PM
It would probably still be more optimal to use a Primary Part, though, considering that a Vector3 won't go through another part and will go on top of it instead.
Report Abuse
BobCowMan is not online. BobCowMan
Joined: 14 May 2010
Total Posts: 22634
04 Jan 2016 04:58 PM
Oh duh i knew about MoveTo(), but I threw it aside since it moves the model instantaneously from A to B but I need it to be gradual. But i suppose i can step it one position at a time


3:8 BCM / Speedyseat(co-owner)
Report Abuse
BobCowMan is not online. BobCowMan
Joined: 14 May 2010
Total Posts: 22634
04 Jan 2016 04:59 PM
@aethex

Thank you but what i need is pretty simple, it won't be going through any other parts


3:8 BCM / Speedyseat(co-owner)
Report Abuse
BobCowMan is not online. BobCowMan
Joined: 14 May 2010
Total Posts: 22634
04 Jan 2016 05:01 PM
Just to put this out there, my mind was more on using bodyforce or bodyvelocity to do the trick, but i guess this is simpler


3:8 BCM / Speedyseat(co-owner)
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
04 Jan 2016 05:06 PM
For easy interpolation, I mentioned using Lerps: http://wiki.roblox.com/index.php?title=Lerp
Report Abuse
BobCowMan is not online. BobCowMan
Joined: 14 May 2010
Total Posts: 22634
04 Jan 2016 05:11 PM
Thanks, ill look into it


and btw i got it, thanks for the help guys



main = game.Workspace.Car.Main
car = game.Workspace.Car

mainX = game.Workspace.Car.Main.Position.X
mainY = game.Workspace.Car.Main.Position.Y
mainZ = game.Workspace.Car.Main.Position.Z


for i = 1, 100 do
car:MoveTo(Vector3.new(mainX-i,mainY,mainZ))
i= i + 1
wait(0.05)
end



3:8 BCM / Speedyseat(co-owner)
Report Abuse
iPenguinSuperTime is not online. iPenguinSuperTime
Joined: 25 Apr 2012
Total Posts: 3757
04 Jan 2016 05:30 PM
oh god vector3.lerp is a headache.
Report Abuse
DivinePheonix is not online. DivinePheonix
Joined: 30 Mar 2011
Total Posts: 11190
04 Jan 2016 06:19 PM
Set a primary part and then cf:lerp() to your position, if your car works you could use the script itself to move it
Report Abuse
DivinePheonix is not online. DivinePheonix
Joined: 30 Mar 2011
Total Posts: 11190
04 Jan 2016 06:23 PM
To make it less complicated:

local OriginCFrame = game.Workspace.Car.PrimaryPart.CFrame

for Index = 1, 10 do
game.Workspace.Car:SetPrimaryPartCFrame(OriginCFrame:lerp(CFrame.new(50,0,0),Index/10))
wait(.3)
end
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
04 Jan 2016 06:28 PM
if u are really lazy and dont mind 'ugly' movement, just make a loop to move one stud at a time, until you reach the destination, via :MoveTo(). though it will look very....... un natural.
Report Abuse
Aethex is not online. Aethex
Joined: 16 Oct 2011
Total Posts: 2193
04 Jan 2016 06:48 PM
@Darkenus ...that's not really a "lazy" option considering the math needed to calculate the steps to move (i.e. translating (0, 42.5, 52.78) to (322.43, 22.1, 232.58) in a linear fashion)

using lerps would be way easier
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
04 Jan 2016 06:52 PM
all this math is making my head spin... srry for typo
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