|
| 17 Apr 2014 02:21 PM |
sorry if my grammar on the tile stunk but..im trying to make like,an "orb" (yknow,it goes around in a circle around me)
ive been trying and trying,but for the life of me,i cant figure it out >_< what I have so far:
me = "Player1" local orb = Instance.new("Part",Workspace) local controller = game.Players[me] local controlTool = Instance.new("Tool",controller.Backpack) local pos = Instance.new("BodyPosition",orb) orb.CFrame = controller.Character.Head.CFrame*CFrame.new(0,0,-10) orb.Anchored = true orb.CanCollide = false pos.position = (controller.Character.Head.CFrame*CFrame.new(0,0,-3)).p orb.Anchored = false local loopPosition = coroutine.wrap(function(obj) while wait() do cf = (controller.Character.Head.CFrame*CFrame.new(0,0,10)) for i=1,270 do cf = cf*CFrame.Angles(0,math.rad(1),0) cf = cf*CFrame.new(0,0,-0.1) newcf = (controller.Character.Head.CFrame*CFrame.new(0,0,10).p) obj.BodyPosition.position = (newcf+cf.p) wait() end end end) loopPosition(orb) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
| |
|
|
| 17 Apr 2014 02:34 PM |
@rofl
I wish ppl would look at the full script..
orb.Anchored = true--anchor orb.CanCollide = false--not collide pos.position = (controller.Character.Head.CFrame*CFrame.new(0,0,-3)).p--set pos orb.Anchored = false--UNANCHOR HERE.. |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 17 Apr 2014 02:35 PM |
| Can you tell us what the problem is, then? |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2014 02:37 PM |
theres no errors,the script just doesn't do what im trying to do..
its supposed to rotate around me..
wow,i do wish ppl would read what I post,not just read one line and be like
0mgeee u cant scr1pttt :3
sigh.. |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2014 02:38 PM |
path orb takes __ (me) "" the ()'s and __'s and ""'s are lines
so basicly,it rotates on axis,around me,a few studs forwards |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 17 Apr 2014 02:45 PM |
while wait() do cf = (controller.Character.Head.CFrame*CFrame.new(0,0,10)) for i=1,270 do cf = cf*CFrame.Angles(0,math.rad(1),0) cf = cf*CFrame.new(0,0,-0.1) newcf = (controller.Character.Head.CFrame*CFrame.new(0,0,10).p) obj.BodyPosition.position = (newcf+cf.p) wait() end end
can all be changed to
local count = 0 while wait() do count = count + 1 cf = (controller.Character.Head.CFrame * CFrame.Angles(0,0.1*count,0) * CFrame.new(0,0,10) obj.BodyPosition.position = cf.p wait() end |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 17 Apr 2014 02:58 PM |
or, even better:
speed = 1 -- or whatever while true do for i=1, 360 do cf = (controller.Character.Head.CFrame * CFrame.Angles(0,speed*i*math.pi/180,0) * CFrame.new(0,0,10) obj.BodyPosition.position = cf.p wait() end end
Think what order you multiply CFrames in:
Imagine X is your head, and Y is the orb
What you did was put Y 10 studs in front of X, and then rotated X
while what you should have done was
rotate Y, then put X 10 studs in front. |
|
|
| Report Abuse |
|
|
|
| 17 Apr 2014 03:55 PM |
I edited a wiki script a while back, it really helped me. Feel free to incorporate in your script.
local angle = 0 while wait() do script.Parent.CFrame = CFrame.new(target.Position) --Start at the position of the part * CFrame.Angles(0, angle, 0) --Rotate by the angle * CFrame.new(0, 0, -5) --Move the part backwards 5 units on the Z axis. angle = angle + math.rad(10) end
When life gives you lemons... BURN HIS HOUSE DOWN! >:D |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Apr 2014 06:38 PM |
'* CFrame.new(0, 0, -5) --Move the part backwards 5 units on the Z axis.' That's a terrible idea, you aren't offsetting it correctly. Use 0, 0, 5 |
|
|
| Report Abuse |
|
|