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
|
  |
| 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 |
|
|
|
| 04 Jan 2016 04:54 PM |
| :MoveTo(Vector3) works on models as well.. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 04 Jan 2016 05:30 PM |
| oh god vector3.lerp is a headache. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|