0

I am trying to simulate a drone model but combining different OBJ files of a drone. I want to animate propeller rotation. So I that I can visualise when it rolls or pitchs which propellers run at a higher pace.

from ursina import *

scales=0.01

def update():
    prop1FrontLeft.rotation_y = prop1FrontLeft.rotation_y + time.dt * 50
    # print(prop1FrontLeft.world_y)
    # print(prop1FrontLeft.world_z)
    # print(prop1FrontLeft.world_x)

app = Ursina()

# Load 3D models from relative folder example
# platform = Entity(model="plane",  collider = "box", texture="grass", scale=100, position = (0, 0, 0))
prop1FrontLeft = Entity(model = "CADmodels/Components/Prop1FrontLeft.obj", texture = "CADmodels/Components/Prop1FrontLeft.png", scale = scales, rotation = (-90, 0, 0))
quadNoProps = Entity(model = "CADmodels/Components/QuadNoProps.obj", texture="QuadNoProps.png", scale = scales, rotation = (-90, 0, 0)) #(-90,0,0) for back facing, (-90, 180, 0) to face front

# prop1FrontLeft.position = (0, -1, 0)
prop1FrontLeft.model_center = (1, 1, 0)

EditorCamera()
sky = Sky()
update()
app.run()

At the moment the propeller rotates around Y axis but definitely not the way I want. I have tried to change position, origin, model center etc but it doesn't make much of difference. It changes position when I put for example (0, -1, 0) but does not rotate around its center about Y axis. Here is my code (If you want to get this to work you need two OBJ files). Ultimately, I would like to make this publicaly available so drone ethusiasts can visualise their developed controller's behaviour. Also, I have looked at other topics related to rotation on Ursina Engine but didn't really help much.

Many thanks, AKKJ

AKKJ
  • 1
  • 2

0 Answers0