#How to scale Entities with Colliders?

1 messages · Page 1 of 1 (latest)

mystic hinge
#

If I wanted to scale an entity up by some arbitrary amount, what would be the best way to do it so that the PhysicsCollider components get updated correctly?

Is the answer different in 0.51 vs 1.0?

I know transform scaling itself has changed, but this question is specifically about how to scale the physics collider.

forest relic
mystic hinge
#

In my case there are no children involved. Just a singular entity with a collider on it. But will keep an eye on both.

mystic hinge
#

Just to update incase anyone else stumbles on this question. It seems to me the answer is that you need to

  1. Grab the PhysicsCollider component on your Entity
  2. Grab the ColliderPtr from that component.
  3. Find out what type of Collider it is (capsule, sphere, mesh, etc.)
  4. After you find out what type of Collider it is, do something like this
CapsuleGeometry geometry = capsuleCollider->Geometry;```
4. Write your own method that scales that specific collider type properly.
5. Apply your new Geometry to the `PhysicsCollider` via the same pointer
#

This requires wrapping your code in unsafe

#

Unless someone can prove otherwise, I have seen no other more convenient way to do this.

median musk
#

Just be careful as unless you tick the, make unique box, this will scale all entities with the same collider