generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How Would you make an object orbit around another?

Previous Thread :: Next Thread 
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 05:52 PM
How would you make an object orbit around another object?
Like an atom, the electrons going around the nucleus, or a moon orbiting earth.

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
28 Sep 2011 05:54 PM
I think CFrame would be the best way to do it.
Report Abuse
citymaster22 is not online. citymaster22
Joined: 10 Jan 2010
Total Posts: 4993
28 Sep 2011 05:54 PM
CFrame? CFrame the position of the object constantly, can't think of any other way right now.
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
28 Sep 2011 05:55 PM
Ya that or just put a motor on top of the motionless brick and put an invisible stick on it with the moving object welded to the end.
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 05:55 PM
i know, but how would would i cframe it?
What i am trying to do is get a sphere to cframe around a character, so it just looks plain awesome. Anyone have any ideas, as to how to do this?

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
RoyStanford is not online. RoyStanford
Joined: 21 Oct 2008
Total Posts: 2222
28 Sep 2011 06:02 PM
umm you could do something like this

wait(.1)
sphere.CFrame = Vector3.new(2,0,0)
wait(.1)
sphere.CFrame = Vector3.new(1.9,0,.1)
wait(.1)
ect.

thats like the worst and longest and most inefficient way to do that.
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 06:08 PM
im thinking something along the lines of random angles, with an i= loop.
Idk the coding tho

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 06:55 PM
This is what i have so far:

X = script.Parent.Parent.Torso.Position.X
Y = script.Parent.Parent.Torso.Position.Y
Z = script.Parent.Parent.Torso.Position.Z
sphere = script.Parent
sphere.CFrame.new()
i=0
while true do
wait(.1)
sphere.Position = v.Position + Vector3.new(i,i,0)
wait(.2)
i = i + .5
end


~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 06:58 PM
It keeps saying new is not a valid member

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
Sadcamp is not online. Sadcamp
Joined: 05 Nov 2010
Total Posts: 21729
28 Sep 2011 07:03 PM
Did you forget to add every humanoid that enters the game/Spawns?
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 07:03 PM
Can someone help me? This is driving me crazy

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 07:04 PM
@sad
i put the sphere with this script into my character.
In the output, it keeps saying:
Wed Sep 28 16:58:24 2011 - new is not a valid member


~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 07:07 PM

X = script.Parent.Parent.Torso.Position.X
Y = script.Parent.Parent.Torso.Position.Y
Z = script.Parent.Parent.Torso.Position.Z
sphere = script.Parent
This line right here> sphere.CFrame.new()
i=0
while true do
wait(.1)
sphere.Position = v.Position + Vector3.new(i,i,0)
wait(.2)
i = i + .5
end

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
TigerBloodd is not online. TigerBloodd
Joined: 24 Oct 2010
Total Posts: 2430
28 Sep 2011 07:11 PM
radius = 10
number = 100
position = script.Parent.CFrame
part = script.Parent
while wait() do
for i = 1, number do
sine = math.sin((360 / number + 360 / number * i) / (180 / math.pi))
cosine = math.cos((360 / number + 360 / number * i) / (180 / math.pi))
part.CFrame = position + Vector3.new(radius * sine, 0, radius * cosine)
part.CFrame = part.CFrame*CFrame.fromEulerAnglesXYZ(0, (360 / number + 360 / number * i) / (180 / math.pi), 0)
wait(0.01)
end
end

TigerBloodd | Programmer | Developer
Report Abuse
TigerBloodd is not online. TigerBloodd
Joined: 24 Oct 2010
Total Posts: 2430
28 Sep 2011 07:14 PM
Use mine, its the most efficient.

TigerBloodd | Programmer | Developer
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 07:21 PM
it works, except it doesnt move with the player while the player is walking.

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
sayhisam1 is not online. sayhisam1
Joined: 25 Nov 2009
Total Posts: 2092
28 Sep 2011 07:23 PM
i tried implementing this:

radius = 10
number = 100
position = script.Parent.CFrame
part = script.Parent
while wait() do
for i = 1, number do
Position = script.Parent.Parent.Torso.Position
sine = math.sin((360 / number + 360 / number * i) / (180 / math.pi))
cosine = math.cos((360 / number + 360 / number * i) / (180 / math.pi))
part.CFrame = position + Vector3.new(radius * sine, 0, radius * cosine)
part.CFrame = part.CFrame*CFrame.fromEulerAnglesXYZ(0, (360 / number + 360 / number * i) / (180 / math.pi), 0)
wait(0.01)
end
end

so that it would move with the player while walking. No luck there...

~I Will kill for you until i finally kill you~ Sayhisam1
Report Abuse
boombatnou is not online. boombatnou
Joined: 15 Feb 2011
Total Posts: 95
09 Jun 2014 11:45 AM
Try using BodyPosition and that stuff.
Report Abuse
Sadcamp is not online. Sadcamp
Joined: 05 Nov 2010
Total Posts: 21729
09 Jun 2014 03:44 PM
@boomb

you're three years late.

screw it, i'm a penguin. i love c&g's faces.
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
09 Jun 2014 03:46 PM
wtf

speed=3;
for i=1,360 do
some_part.CFrame=some_part.CFrame*CFrame.new(0,math.rad(i)*speed,0)*CFrame.Angles(0,0,0);wait(.125)end;
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image