|
| 27 Mar 2014 08:23 AM |
So is it possible for me to script a model to slide down? Right now I am trying to make a countdown where the numbers slide down in front of you then a big red 'GO' slides down so you start the sf. I was about to make it then I realised that models don't have a position problem. I figured out I can just make them appear and disappear but that is not that good and now I need to do it all over again. Also is there a way for me to set the time it takes it to slide from one place to another? Because I need it to be exactly one second
Thank you, moazmoazmoaz
Also if you know about any tutorials that teach this I might prefer that then just being given the script. |
|
|
| Report Abuse |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 27 Mar 2014 08:56 AM |
| So you mean you're using models to do the countdown? |
|
|
| Report Abuse |
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 27 Mar 2014 08:57 AM |
| Or it's just the 'GO' that's a model? |
|
|
| Report Abuse |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 27 Mar 2014 09:10 AM |
There's always :MoveTo() but that doesn't work so well. I actually made a function that sets the CFrame of each part in the model, and it works much better.
function moveModel(model, pos) local centre = model:GetModelCFrame() local offsets = {} local children = model:GetChildren() for i=1, #children do if children[i]:IsA("BasePart") then local rot = children[i].CFrame - children[i].Position offsets[i] = children[i].CFrame.p - centre.p children[i].CFrame = rot + pos + offsets[i] end end end
Combine that with a for loops in another function, and you should be able to smoothly 'slide' a model.
function slideModelTo(model, targetVec, seconds) local m = model local time = seconds local curPos = model:GetModelCFrame().p for i=0, time ,1/30 do local v = (targetVec - curPos) / time * i moveModel(m,curPos+v) wait() end end
slideModelTo(Workspace["Part"], Vector3.new(50,100,0), 5) |
|
|
| Report Abuse |
|