1
$\begingroup$

I have set up a scene in the bge where I need to animate the mist. I have an object that loops between 0 and 4999 and I assigned its action current frame number to a property called 'axisT' Now I want to be able to modulate the result so that at frame zero mist color = [1, 1, 1] and at frame 1250 mist color = [1.0, 0.9, 0.8] and so on at each step until my loop starts back. What is the correct way to do this ? enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

Sorry to answer my own question but here is how I got through it.

import bge
import math

scene = bge.logic.getCurrentScene()
A = scene.objects['Axis']['time']
mist = scene.world
F = math.sin(math.pi*A/2500)

if (A) < (1250):
    mist.mistColor = [1.0, 1.0-F*0.1, 1.0-F*0.2]
elif ((A) >= (1250)) and ((A) < (2500)):
    mist.mistColor = [F*0.8+0.2, F*0.7+0.2, F*0.6+0.2]    
elif ((A) > (2500)) and ((A) < (3750)):
    mist.mistColor = [0.2-F*0.6, 0.2-F*0.6, 0.2-F*0.3]
elif (A) >= (3750):
    mist.mistColor = [1.0 + F*0.2, 1.0+F*0.2, 1+F*0.5]
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .