Reputation: 55
I have an .obj file which the model i want to add, which is stored at:
C:\Users\MTLS\source\python\Models_2-3D models\Triangular_Prism.obj
But when i try to load the model into the entity using this code:
spike_model = r'C:\Users\MTLS\source\python\Models_2-3D models\Triangular_Prism.obj'
class Spike(Entity):
def __init__(self, position = (0, 0, 0)):
super().__init__(
model = spike_model,
texture = 'white_cube',
collider= 'box',
color= color.red,
scale= (1, 1, 1),
position= position
)
spike = Spike()
The entity is only loaded as an invisible entity, i cant see it when i launch the program.
I have followed some tutorials on yt but non of them works
How can i fix this and make the entity become visible? Thanks.
Upvotes: 0
Views: 108
Reputation: 1489
Use relative path, not absolute path. ursina assumes you want to distribute your game at some point and that your assets are in the same folder or below as the script. So the solution is to move the model into that folder.
It's also possible to use load_model(name, path)
or modify application.asset_folder
in order to load from a different folder, but keep in mind that will only work on your computer.
Upvotes: 1