Hide or fade out/fade in object

Hi

I’d like to create a function that hides an object, preferably by fading it out over the course of a few seconds. Can I use some function on the ModelComponent like hide(), or do I have to pull a list of all Model mesh instances, iterate through those and work on the material of that mesh somehow? Looking through the API I can’t seem to find any opacity properties on the Material object for example.

Any advice here would be very helpful

Best regards

  • Björn

http://developer.playcanvas.com/en/api/pc.StandardMaterial.html#opacity
here is the api reference, you can use a for cycle to change the material opacity till vanish

1 Like

Great, thank you! I was staring at the Material class but now I understand it’s just the base /parent class.

Welcome! Sometime we can’t find what is in front of our eyes when too focused :slight_smile:

Also this question has been asked numerous times on the forum so should be plenty of code examples to help you out. Just search for fade out :slight_smile:

1 Like