Dorandir
|
  |
| Joined: 06 Aug 2016 |
| Total Posts: 844 |
|
|
| 19 Apr 2017 02:08 PM |
Hello! I want to make my player to be forced to run around in a circle, but I'm unsure how to get the circular points he would run to. I know it has something to do with pi right?
Center = HumanoidRootPart.Position
for i = 1 , 36 do Humanoid:MoveTo(Center + Vector3.new(???)) wait(0.5) end |
|
|
| Report Abuse |
|
|
Atavis
|
  |
| Joined: 10 Apr 2012 |
| Total Posts: 1463 |
|
|
| 19 Apr 2017 02:13 PM |
nextPoint = part.CFrame*CFrame.Angles(0, 0, math.rad(1)) + Vector3.new(0, 0, radius) ?
I guess alternate between axis according to the 3D space you're working in.
#code --This validates my comment. |
|
|
| Report Abuse |
|
|
Dorandir
|
  |
| Joined: 06 Aug 2016 |
| Total Posts: 844 |
|
|
| 19 Apr 2017 02:24 PM |
| But MoveTo is for Vector3? How can I use that with Vector3? |
|
|
| Report Abuse |
|
|
Atavis
|
  |
| Joined: 10 Apr 2012 |
| Total Posts: 1463 |
|
|
| 19 Apr 2017 02:28 PM |
get the CFrame.p calculated by the new point. idk
#code --This validates my comment. |
|
|
| Report Abuse |
|
|
Atavis
|
  |
| Joined: 10 Apr 2012 |
| Total Posts: 1463 |
|
|
| 19 Apr 2017 02:29 PM |
part being the centre of the circle btw.
#code --This validates my comment. |
|
|
| Report Abuse |
|
|
Dorandir
|
  |
| Joined: 06 Aug 2016 |
| Total Posts: 844 |
|
|
| 19 Apr 2017 02:31 PM |
| I tried this and it took me to the same spot each time. ####### ###### = HumanoidRootPart.CFrame.p ############### + Vector3.new(0, 0, 6) for i = 1, 36 do Humanoid:MoveTo((CFrame.new(Center) * CFrame.Angles(0, 0, math.rad(i * 10)) + Vector3.new(0, 0, 6)).p) wait(1) end |
|
|
| Report Abuse |
|
|
Dorandir
|
  |
| Joined: 06 Aug 2016 |
| Total Posts: 844 |
|
|
| 19 Apr 2017 02:34 PM |
| GOT IT! ####### ###### = HumanoidRootPart.CFrame.p ############### + Vector3.new(0, 0, 6) for i = 1, 36 do Humanoid:MoveTo((CFrame.new(Center) * CFrame.Angles(0, math.rad(i * 10), 0) * CFrame.new(0, 0, 6)).p) wait(.1) end |
|
|
| Report Abuse |
|
|
Atavis
|
  |
| Joined: 10 Apr 2012 |
| Total Posts: 1463 |
|
|
| 19 Apr 2017 02:36 PM |
I'll try and write something out one sec.
local part = script.Parent local nextPoint local radius = 5 local degreesInACircleBecauseROBLOXFilterDoesntLikeMe = 360
for i = 1, degreesInACircleBecauseROBLOXFilterDoesntLikeMe do nextPoint = part.CFrame*CFrame.Angles(0, i, 0) + Vector3.new(0, 0, radius) humanoid:MoveTo(nextPoint) end
I just wrote that out withou... without putting in enough effort, so you might need to change it or something idk but hopefully I've explained the concept to you.
#code --This validates my comment. |
|
|
| Report Abuse |
|
|