Hello
Lets say I have 2 circles
I want 1 of those circles to orbit around the other
How would I do this? Is there a formula?
Making an object orbit around another object
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: Making an object orbit around another object
Do you want an actual orbit or just an object following a circle path?
Re: Making an object orbit around another object
Could you provide both?
Re: Making an object orbit around another object
To rotate an object around an other object, you can use math.sin and math.cos for it. Heres an example:
Hope this helps a bit.
Code: Select all
angle = angle + 1*dt
distance = 100
local new_x = object.position_x + math.sin(angle) * distance
local new_y = object.position_y + math.cos(angle) * distance
--now apply new_x and new_y for the object that should rotate around the other object
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: Making an object orbit around another object
Well that is not an orbit that is to make an object follow a circular path. Making a true representation of an orbit it would require googling of how an orbit work and probably not look like how you would want. I tried a true orbit once. I gave up lol
Re: Making an object orbit around another object
Well I know, but he asked also for a circular path . Only wanted to show a basic example for it.bobbyjones wrote:Well that is not an orbit that is to make an object follow a circular path. Making a true representation of an orbit it would require googling of how an orbit work and probably not look like how you would want. I tried a true orbit once. I gave up lol
Sad to hear but math can sometimes be pretty complicated.
Re: Making an object orbit around another object
here is a orbiting project I've seen some time ago
Who is online
Users browsing this forum: DTmg, Semrush [Bot] and 4 guests