[Python] How do I make a mesh colider for a fbx file in ursina engine, python?

Discussão em 'Python' iniciado por Stack, Maio 3, 2025.

  1. Stack

    Stack Membro Participativo

    So, I'm making my own horror game and I decided to use ursina. I wanted to add a mesh collider to my "floor" that is in an fbx type file. So... I dont realy now how to use it, but I tried. Here is my code(yeah, Its pretty stuid):

    from ursina import *
    from ursina.prefabs.first_person_controller import FirstPersonController

    app = Ursina()


    model_entity = Entity(
    model='world1.fbx', # Használd a tényleges fájlnevet
    position=(0, -200, 0), # A modell alját állítjuk be a kívánt pozícióra
    scale=(10, 10, 10) # A helyes scale értékek (x, z, y)
    )

    model_entity.collider = MeshCollider(model_entity) # Itt adjuk át a modellt a MeshCollider-nek

    player = FirstPersonController(
    position=(0, 800, 0), # A játékost a modell teteje fölé rakjuk
    speed=8
    )
    player.gravity = 1
    player.collider = BoxCollider(player, Vec3(0, 1, 0), Vec3(1, 2, 1))

    Sky()
    DirectionalLight().look_at(Vec3(1, -1, -1))
    mouse.locked = True

    app.run()


    it doesn't gives me problems, but still, I just fall over the object. Could someone make my code working? Thanks for helping!

    So I really tried everything but I didn't find any informations. So if some of you guys found out how to do it, it would be really good.

    Continue reading...

Compartilhe esta Página