Python: How to..?

Ok here are three questions I have:

Can you with python, change the world color in realtime? (The fog)
Can you replace a mesh with python, without the replace mesh actuator?
Can you with python change a motion actuator in realtime? (example changing drot from 10.0 to 20.0)

I suspect that they are all not possible but…

#1 yes
#2 no but you can replace with several different meshes using only one actuator
#3 yes, easy

Acually, i’m pretty sure #2 is possible… but i don’t know why you’d want to do it with python.

Pooba

Great, can someone then show me an example on these?

Acually, i’m pretty sure #2 is possible… but i don’t know why you’d want to do it with python.

1.Python is faster than logic bricks
2.Whats better: 10 objects with 10 replace mesh actuators = 100 actuators or 10 objects with 1 script? :wink:
3.Turn on “Show framerate and profile” on a game and you will see that gamelogic or “logic” is a resource hog!

#1, have mist off, dont have a world set.:

import Rasterizer
Rasterizer.setMistColor([R,G,B]) ## value 0 to 1
Rasterizer.setBackgroundColor([R,G,B]) ## value 0 to 1
Rasterizer.setMistStart(x) 
Rasterizer.setMistEnd(x) 

#2 link script to replace mesh actuator

import GameLogic
con=GameLogic.getCurrentController()
act=con.getActuator("act") ## make sure the actuator is named "act"
act.setMesh("X") # X=what the name of the mesh you want is

#3 link script to motion actuator

import GameLogic
con=GameLogic.getCurrentController()
act=con.getActuator("act") ## make sure the actuator is named "act"
act.setForce(x,y,z,1)
act.setTorque(x,y,z,1)
act.setDLoc(x,y,z,1)
act.setDRot(x,y,z,1)
act.setLinearVelocity(x,y,z,1)
act.setAngularVelocity(x,y,z,1)

Thanks cluh!