Cyerwyn
|
  |
| Joined: 09 Mar 2013 |
| Total Posts: 3442 |
|
|
| 27 Jul 2016 09:34 AM |
| If I had a sort of pod like object which would be lowered into the ground, what would I use? |
|
|
| Report Abuse |
|
|
Everoso
|
  |
| Joined: 26 Jul 2016 |
| Total Posts: 189 |
|
|
| 27 Jul 2016 09:35 AM |
Uhh, either body movers or lerp it with CFrame.
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 09:36 AM |
it depends how you want it to work
if you want it to run on roblox's physics, use a bodymover object like bodyvelocity or bodyposition
you can also do it through cframe which is more reliable but not physics based |
|
|
| Report Abuse |
|
|
Cyerwyn
|
  |
| Joined: 09 Mar 2013 |
| Total Posts: 3442 |
|
|
| 27 Jul 2016 09:36 AM |
This is actually in relation to the union thing, here I'll post the script.
allp = script.Parent pb = allp.pb pm = allp.pm pt = allp.pt cp = allp.ctpanel act = cp.SurfaceGui.Activate.TextButton deact = cp.SurfaceGui.Deactivate.TextButton status = cp.SurfaceGui.StatusActual.TextBox
act.MouseButton1Click:connect(function() print("ACTIVATED") status.Text = "ACTIVATED" status.TextColor = BrickColor.new(0, 255,0) for i,v in pairs(allp:GetChildren()) do if v.ClassName == "UnionOperation" then print("Union detected!") for i=1, 10 do wait() v.CFrame = CFrame.new(0, -10, 0) end end end end)
deact.MouseButton1Click:connect(function() print("DEACTIVATED") status.Text = "DEACTIVATED" status.TextColor = BrickColor.new(255, 0, 0) end)
====
I tried using CFrame, but it goes all wonky and wrong. Any help would be greatly appreciated. |
|
|
| Report Abuse |
|
|
Everoso
|
  |
| Joined: 26 Jul 2016 |
| Total Posts: 189 |
|
|
| 27 Jul 2016 09:37 AM |
I have a bad feeling that every glitchy elevator ever was using body movers.
|
|
|
| Report Abuse |
|
|
Everoso
|
  |
| Joined: 26 Jul 2016 |
| Total Posts: 189 |
|
|
| 27 Jul 2016 09:37 AM |
"pb = allp.pb"
This is sort of irrelevant but please have more descriptive variable names. I have no idea what pb is.
|
|
|
| Report Abuse |
|
|
Cyerwyn
|
  |
| Joined: 09 Mar 2013 |
| Total Posts: 3442 |
|
|
| 27 Jul 2016 09:39 AM |
@Ever
pb, pm, and pt are union parts for the sections of the pod. Pb = Pod Bottom, Pm = Pod Middle, and so on. |
|
|
| Report Abuse |
|
|
Everoso
|
  |
| Joined: 26 Jul 2016 |
| Total Posts: 189 |
|
|
| 27 Jul 2016 09:40 AM |
Word of advice: name the variables podBottom, podMiddle, and so on if you give the first crap about the quality of your code.
Anyway for the elevator I'm leaning towards CFrame:lerp()'ing it.
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 09:41 AM |
CFraming it is probably more reliable. Just make sure it doesn't move too fast and causes you to fall through the floor.
( ͡• ◡ ͡•) -=[ RAP: 348,035 || DurstAuric; the narb of ROBLOX ]=- ( ͡• ◡ ͡•) |
|
|
| Report Abuse |
|
|
Cyerwyn
|
  |
| Joined: 09 Mar 2013 |
| Total Posts: 3442 |
|
|
| 27 Jul 2016 09:44 AM |
"returns a CFrame interpolated between this CFrame and the goal by the fraction alpha"
I'm sorry, what? |
|
|
| Report Abuse |
|
|
Everoso
|
  |
| Joined: 26 Jul 2016 |
| Total Posts: 189 |
|
|
| 27 Jul 2016 09:44 AM |
Or weld them. Definitely weld them if it's fast-moving.
|
|
|
| Report Abuse |
|
|
Everoso
|
  |
| Joined: 26 Jul 2016 |
| Total Posts: 189 |
|
|
| 27 Jul 2016 09:45 AM |
In English:
It gets a CFrame part-way between the start and the end based on what you define (what you define is the "alpha").
So if I have part A and part B I can get a CFrame half way between them with it.
|
|
|
| Report Abuse |
|
|
Cyerwyn
|
  |
| Joined: 09 Mar 2013 |
| Total Posts: 3442 |
|
|
| 27 Jul 2016 09:49 AM |
| The wiki is so confusing, how exactly do you use cframe:lerp()? |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 10:22 AM |
local startcframe = CFrame.new(starting position) local endcframe = CFrame.new(goal position)
local elevatorpart = part u want to move
for i = 1, 100 do elevatorpart.CFrame = startcframe:lerp(endcframe, i/100) wait() end
that would move the elevator from the old position to the new position in 100 wait()s |
|
|
| Report Abuse |
|
|