#Get or set Entity Physics Material from script.

1 messages · Page 1 of 1 (latest)

silent pelican
#

How do I get or set the Physics Material of an Entity that is part of the Entity Physics System? I want to change its restitution/bounciness in realtime. Thanks for your time.

silent pelican
#

Could I modify the PhysicsPackage from github and make the restitution/bounciness float public and change it from there?

dusty onyx
silent pelican
#

Thanks! I’ll check it out and post here the solution if I find it 👍🏻

silent pelican
#

I found the solution and it's very hidden. To get the Restitution:

#

entityManager.GetAspect<Unity.Physics.Aspects.ColliderAspect>(entity).GetRestitution();

#

To set the restitution:

#

entityManager.GetAspect<Unity.Physics.Aspects.ColliderAspect>(entity).SetRestitution(0.5f)