I’m making a small game just to see if I could do it. I know how to set up mist in Blender, my question is that what would I have to do to change the mist settings (start, end and color) during the game. For instance, when the character goes under water, I would like the mist to turn a different color and increase in intensity, simulating the environment of water. Then, of course, when the character left the water, the mist would return to the normal world settings.
How would I go about doing this? I’m assuming that logic bricks are probably out of the question.
Are you using 2.48 or 2.49RC1?
edit: scratch that, I used that wonderful scroll functionality of the mouse and saw you said you were getting a test build
I’m having trouble getting the console to post error messages for me. I’m using Ubuntu Linux. I execute Blender through a console, but still can’t seem to get any messages through it.
Basically, I’m in rough shape. =(
I added:
get the object this script is attached to
owner = controller.getOwner()
After the import Rasterizer item.
EDIT:
Aha! I can run 2.46 in Konsole! Error:
PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “ocean.py”, line 6, in <module>
NameError: name ‘controller’ is not defined
PYTHON SCRIPT ERROR:
Traceback (most recent call last):
File “ocean.py”, line 6, in <module>
NameError: name ‘controller’ is not defined
Might as well post this before it becomes a really naughty bump. =)
Here is a sample .blend file with my stab at a script. As this is my first python script, I’d like to know what am I doing wrong, as it’s not working, and it’s driving me bananas. =(
Did some reading up on that error, and it looks like the new Blender has updated python codes to catch up to the standard. Lots of old stuff is deprecated in favor of newer commands.
At any rate, it still doesn’t work, so it’s probably still impossible. =(
so Rasterizer.setMistColor would become Rasteriser.MistColor etc… and I’m not sure if you need to do the whole owner thing at all… this is assuming they’ve updated the rasterizer module.
Still nothing working. Not looking very promising. =(
Python script error from controller "cont#CONTR#1":
Traceback (most recent call last):
File "ocean.py", line 10, in <module>
AttributeError: 'module' object has no attribute 'MistColor'
Python script error from controller "cont#CONTR#1":
Traceback (most recent call last):
File "ocean.py", line 10, in <module>
AttributeError: 'module' object has no attribute 'MistColor'
Not giving up, mind you, but it’s really bugging me. I really need this to work if I’m to get this going.
Thanks for the tips, though. They help. Keep them coming, if anyone has anymore.
Not all the get/set functions have been deprecated though, there’s still plenty of functions that still require the old way, I’m sure it’ll become less and less as the new system encompasses more of the API.