i’m trying to move a camera entity using physics (i know i don’t have to do it that way; it is for [kin]aesthetic reasons), but i can’t seem to apply forces to its rigidbody unless it has a collider (which also causes the camera to be affected by gravity, is that something i can disable on a per-rigidbody basis?) is there a way around this? in other engines i might put the object on its own layer and prevent that layer from interacting with other layers, but i can’t seem to do that here either.
That’s correct, to apply forces you need a dynamic rigidbody, but yeah that will also mean gravity affects the body.
If using a kinematic body isn’t an option for you, then you will need to compensate for gravity by applying an opposite upwards force or zeroing the bodie’s linear velocity on Y.
On Ammo3 there is an option to disable gravity per object, but PlayCanvas uses an older Ammo version right now.
ok that’s fine i can deal with that.
and as for the collider? the rigidbody itself is dynamic but i don’t want it bumping into anything. i don’t suppose i could pass in a mesh that happens to have no tris as the collision shape… hmm.
You can use rigidbody group/masks property to handle with which bodies it can collide with. Check this post, it includes an example project too:
oh ok sweet i wondered if there were layermasks. i’ll have a closer look at the ammo api, cheers.
answer(?): colliders can be made effectively intangible by changing the rigidbody group to none like so:
this.entity.rigidbody.group = pc.BODYGROUP_NONE;
not sure if there’s a downside to this exactly but it works!
I think that’s the official Bullet/Ammo way, thanks for sharing it!