Collider

Base class for attaching collision shapes to Entities.

Collider

Collider(entity, shape)

Creates a Panda3D collision node and attaches it to entity.

Constructor Arguments

NameTypeDescription
entityEntityParent entity to attach the collider to.
shapeanyShape descriptor: string ('box', 'sphere', etc.) or collider object.

Properties

PropertyDescription
.visiblebool — Whether to show the debug collider.

Methods

MethodDescription
remove()Detach and destroy the collision node.

Example

from ursina import *
from ursina.collider import Collider

app = Ursina()
e = Button(model='cube', color=color.red)
e.collider = 'box'           # add box collider
e.collider = Collider(e, 'sphere')  # custom collider
app.run()
Back to API Reference