Hello
can anyone explain the set.Trasparencey command I have read the instructions in the manual. However it is not clear to me where i can change the transparency using the values between 0 and 1.0
I have tried several things but just get errors so I am not using the command correctly
I have tried
self.moon.setTransparency(0.8)
or
self.moon.setTransparency(TransparencyAttrib.MAlpha, 0.8)
here the message i got in my terminal
Traceback (most recent call last):
File "ball02.py", line 142, in <module>
w = world()
File "ball02.py", line 28, in __init__
self.moon.setTransparency(0.8)
TypeError: integer argument expected, got float
So my question is where in the command can I change the attributes because it is not clear to me from reading the manual.
If you want a model to be transparent you can use its texture alpha channel or vertex color. With the texture you’d be best using some image editing software (Gimp, Photoshop, etc), you can set the vertex alpha in a modeling package (if the export script supports that), in the models egg file or using nodePath.setAlphaScale(0.8) or nodePath.setColor(1,1,1,0.8)
Yes… and not really, no. setTransparency() should be used with one of these values:
TransparencyAttrib.MNone
TransparencyAttrib.MAlpha
TransparencyAttrib.MNotused
TransparencyAttrib.MMultisample
TransparencyAttrib.MMultisampleMask
TransparencyAttrib.MBinary
TransparencyAttrib.MDual
These are constants, so TransparencyAttrib.MNone==0, TransparencyAttrib.MAlpha==1
TransparencyAttrib.MDual==6 and so on.
So You could use setTransparency(6), but don’t, use setTransparency(TransparencyAttrib.MDual).