Change size with code

image

How do I change the collision size of the opposite object with code when you hit an object?

You should be able to set a new vec3 to the property: https://developer.playcanvas.com/api/pc.CollisionComponent.html#halfExtents

However, ever time you do this, it destroys and creates a new physics body so it isn’t a cheap operation.

1 Like