This is a pretty noob question but it’s baffling me. How can I make an object invisible in such a way that I can still set up collisions with it?
I tried texturing a transparent .gif to it but to no avail.
Here’s what I tried:
self.leftbar = loader.loadModelCopy("models/leftbar2")
self.leftbar_tex = loader.loadTexture("models/invisible.gif")
Any help is greatly appreciated!
The easiest way to do this is with the hide() method on NodePath.
This disables the render traverser from following the model, but should still allow the collision traverser to check it.
Best of luck!
Thank you that worked perfectly! I have one more question: Is there a way to make a whole model transparent (eg change an overall alpha value)?
Yes, using PNG. Make a PNG with an alpha channel.
Your way didn’t work because Panda3D cannot load GIF’s.
Ah, good old patent-protected GIF. That one dirty secret of the Internet that no-one likes to talk about.
The way I usually make an entire model have the same transparency is to first enable transparency on the model’s nodepath:
Then use the color scaler to give the whole model an alpha value:
That method is particularly useful in a LerpFunction to do fade in / fade out effects.
If you want to do something more complicated (like different levels of transparency), then a PNG with alpha channels might serve better.
Best of luck,
Hi, sorry if this is old news but you can set your model this way:
where the “0” will be invisible but still able to accept collisions if it is “1” it will be visible
EDIT…sorry! mctomczak said it first and better!..also helped me understand it too!