(sorry, not good at explaining)
basically im trying to create a physics simulation of a solar system but in order to do so i need to create an array that both contains all objects in the system and can be accessed by them so i can calculate forces. I would know how to do this in python :
Class Body:
def __init__(self, size, mass, position):
self.size=size
self.mass=mass
self.position=position
Class World:
def __init__(self, Count):
self.bodies=[]
for i in range(Count):
size=input("enter size")
mass=input("enter mass")
position=input("initial position")
newBody=Body.__init__(size, mass, position)
self.bodies.append(newBody)
update()
def update(self):
for n in self.bodies:
for x in self.bodies:
"""calculate force of x on n"""
"""apply forces to n"""
but i have no idea how to do this in unity.