color-changing objects
color-changing objects
how would i make something such as a red-white blinking light?
-
- Private First Class
- Posts: 1400
- Joined: Sun Feb 06, 2005 5:40 pm
- Location: Somewhere over there.
Code: Select all
dynamicColor
name red_light
red sinsoid 1 5 0
end
it makes the thingy you assign it to change from red to either alpha or black taking 5 seconds to go from black to red, i think
- ducatiwannabe
- Private First Class
- Posts: 3258
- Joined: Tue Aug 10, 2004 3:55 pm
- Location: Planet Earth
- Contact:
Try to be more descriptive when you give somebody help. Lots of answers to help are so vague it's like we think the person needing help already knows what he's asking for help on...no, don't take this wrong. I was just suggesting...use dynamic colors
I don't really understand dynamic colors...but here's something that will blink different colors if you add it to your map.
dynamicColor
name flash
blue sinusoid 5 0 0.8
red sinusoid 7 0 0.8
green sinusoid 3 0 0.8
end
I used the mesh texture in a material.
material
name default
dyncol flash
texture mesh
color 1 1 1 1
end
Then to add it to a meshbox or anything all you do is.
meshbox
name blahblah
matref default
position 0 0 0
rotation 0
size 10 10 10
end
Last edited by ducatiwannabe on Wed Mar 15, 2006 1:08 am, edited 1 time in total.
too bad...Win Xp wrote:I like people to do research themselves
The Dynamic Color object
dynamicColor
name example_dyncol
# there are 4 channels that can be modified:
# red, green, blue, alpha
# there are 5 types of commands per channel:
# limits, sinusoid, clampUp, clampDown, sequence
# except for "limits" and "sequence", the commands are repeatable
# if a sequence is used, then clampUps and clampDowns have no effect
# sequences can use three states (0, 1, 2).
# 0 - equivalent to an active clampDown
# 1 - equivalent to active clampUp and clampDown
# 2 - equivalent to an active clampUp
# if both clampUp and clampDown are active, the value is (min+max)/2
# the sinusoid function starts at the max value
# the sum of a channel's sinusoids is clamped between 0 and 1
red limits 0 1 # min/max limits
green sinusoid 0.1 0 0.25 # period, offset, weight
blue clampUp 0.1 0 0.75 # period, offset, width
alpha clampDown 0.2 0.5 0.5 # period, offset, width
red sequence 0.0 0.0 0 2 1 1 2 0 ... # period, offset, list of states
end
- ducatiwannabe
- Private First Class
- Posts: 3258
- Joined: Tue Aug 10, 2004 3:55 pm
- Location: Planet Earth
- Contact:
sphere
name light
divisions 20 # number of subdivisions
flatshading # flat shading (smooth is default)
position 0.0 0.0 1114.0
size 2 2 2
radius 10 # sets all size values to this value
shift 0 0 0 #(repeatable)
scale 1 1 1 #(repeatable)
shear 0 0 0 #(repeatable)
smoothbounce # ricochets use normals
end
i want this to flash red on and off, like a light you see on a tower.
on for 1 second, off for 5
name light
divisions 20 # number of subdivisions
flatshading # flat shading (smooth is default)
position 0.0 0.0 1114.0
size 2 2 2
radius 10 # sets all size values to this value
shift 0 0 0 #(repeatable)
scale 1 1 1 #(repeatable)
shear 0 0 0 #(repeatable)
smoothbounce # ricochets use normals
end
i want this to flash red on and off, like a light you see on a tower.
on for 1 second, off for 5
-
- Private First Class
- Posts: 1400
- Joined: Sun Feb 06, 2005 5:40 pm
- Location: Somewhere over there.
Code: Select all
dynamicColor
name flash
red sinusoid 0.1 0 0.25
end
sphere
name light
divisions 20
flatshading
position 0.0 0.0 1114.0
size 2 2 2
radius 10
smoothbounce
dynCol flash
end
-
- Private First Class
- Posts: 220
- Joined: Tue Jul 26, 2005 10:32 pm
- Location: Gainesville Florida
Code: Select all
dynamicColor
name flash
blue sinusoid 2 0 1
green sinusoid 2 0 1
alpha sinusoid 2 1 0.6
end
material
name light
dyncol flash
end
anomaly is right on!
I can contribute a little to dyncolors... all I know is about sinusoids.
sinusoid 0.1 0 0.25 # period, offset, weight
Period: speed. How long it takes the channel to go from 0 to 1 and back, I think.
Offset: Not exactly sure, I think it is how many seconds offset the sinusoid is relative to a sinusoid with an offset of 0. I always leave it at 0 except for complex effects. Maybe it is the difference between the time it is 0 and the time it is 1?
Weight: I think this is the time spent at 0 or 1.... the higher, the quicker the transition. Or maybe the slower. I forget.
I messed with dyncolors a long time ago (relatively) and have forgotten most of the stuff I figured out.
There should be a dyncolor wiki!
I can contribute a little to dyncolors... all I know is about sinusoids.
sinusoid 0.1 0 0.25 # period, offset, weight
Period: speed. How long it takes the channel to go from 0 to 1 and back, I think.
Offset: Not exactly sure, I think it is how many seconds offset the sinusoid is relative to a sinusoid with an offset of 0. I always leave it at 0 except for complex effects. Maybe it is the difference between the time it is 0 and the time it is 1?
Weight: I think this is the time spent at 0 or 1.... the higher, the quicker the transition. Or maybe the slower. I forget.
I messed with dyncolors a long time ago (relatively) and have forgotten most of the stuff I figured out.
There should be a dyncolor wiki!
-
- Private First Class
- Posts: 220
- Joined: Tue Jul 26, 2005 10:32 pm
- Location: Gainesville Florida
The offset affects the start time. Add the offset to the start time in other words. Thats why the alpha channel offset is half the period of the color channels in my original post. Alpha channel starts swinging towards transparent after the color channels have reached max. Otherwise the colors would go transparent at the same time they reached their max (saturated) values. That would cause the color to not be seen very well. Probably not what most of us want to achieve. Think of the time period of a sine wave (sinusoid). Thats probably how the equations are done in the code. I haven't looked at the code to find out though. Maybe later.