'how do I make a sphere rotate around another sphere in ursina, python
from ursina import *
# update sphere_2 rotation
def update():
line.rotation_y += 1
sphere_2.rotation_y += 1
app = Ursina()
sphere_1 = Entity(model = 'sphere',scale = 2)
# try to make sphere_2 follow the lines rotation
line = Entity(model = 'line',scale = 4,y = -1)
sphere_2 = Entity(model = 'sphere',scale = 1,x = -2)
app.run()
Solution 1:[1]
Parent sphere_2 to sphere_1. sphere_2.parent = sphere_1
to make position, rotation and scale relative to sphere_2. Or sphere_2.world_parent = sphere_1
, if you want to keep the original transformation intact after parenting it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pokepetter |