[req] simple traffic light w/ red,yellow,green animation

Posted By: jpxtreme

[req] simple traffic light w/ red,yellow,green animation - 02/05/11 07:33

I already have some traffic light models but they don't have animations. I cannot figured out how to animate the model to make the color change. I'm really a noob in model making in MED.

If someone is kind enough to share or better yet animate this model. Just 3 frames of animation is enough. The frame 1 is for red and then next is yellow then green. Then I really be thankful because It's a big help for my simple car game.

here's the link...

traffic_light.MDL


Hoping for someone to lend a hand. Thanks!
Posted By: Clemens

Re: [req] simple traffic light w/ red,yellow,green animation - 02/05/11 09:41

Did you already try to realize that effect with a dynamic light, switching its position and changing its color?

Edit: Oh and by the way: a look inside the model shows me that it has a lot of polygons related to its extreme low poly look.
Posted By: Blattsalat

Re: [req] simple traffic light w/ red,yellow,green animation - 02/05/11 19:48

Hi,

The easiest way to create the effect would be exchangable textures for every state of light set up.

Another way would be hiding (or creating in realtime) models underneath the unlit lights that have a lit texture on them. Then either animate them to hover over the unlit version of themselfs or create them via code during runtime.

Another way would be shaders, but thats not a beginners way.

I would highly recommend to create this stuff by yourself instead asking others to do it for you. its harder and more time consuming but you will learn quite a bit about models, textures, meshes and problem sollution that way.


just give it a try,
cheers
Posted By: Det

Re: [req] simple traffic light w/ red,yellow,green animation - 02/05/11 20:14

Hello !

If you need a code for a Trafficlight I have it but it`s not Lite C it`s C Script that works with a Traffic Light Model but you must to modify the C Script Code in to a Lite C Code Let me know if you want the code .
Posted By: jpxtreme

Re: [req] simple traffic light w/ red,yellow,green animation - 02/06/11 01:49

@det

I would like to see your code if I can convert it to lite c. The most easiest way to do it would be changing the model by coding. Model 1 has red light model 2 has green light and 3 for red light.

I think this is easy for a noob like me. Thanks all for the response.
Posted By: Det

Re: [req] simple traffic light w/ red,yellow,green animation - 02/06/11 19:27

Hi jpextreme !

Ok here is the Code in C Scipt for your Trafficlight :

Code:
var ampelvar = 1;

function ampel_event()
{
  while (ampelvar == 1) // wenn Ampel an 
  {
    my.skin = 1; //grüner Skin  green skin
    my.lightrange = 1000; //Reichweite des Lichts range of light 
    my.red = 0;
    my.green = 255; 
    my.blue = 0;//grünes Licht   green light 
    waitt (960); //warte 60 sek
    my.skin = 2; //gelber Skin
    my.lightrange = 1000; //Reichweite des Lichts  range of light 
    my.red = 255;
    my.green = 255; 
    my.blue = 0; //gelbes Licht  yellow ligt 
    waitt (32); //warte 2 sek
    my.skin = 3; //roter Skin    red skin 
    my.lightrange = 1000; //Reichweite des Lichts  range of light 
    my.red = 255;
    my.green =0; 
    my.blue = 0; //rotes  Lcht    red light 
    waitt (240); //warte 15 sek   wait 15 seconds 
    my.skin = 2; //gelber Skin    yellow skin 
    my.lightrange = 1000; //reichweite des Lichts
    my.red = 255;
    my.green = 255;
    my.blue = 0; //gelbes Licht   yellow light 
    waitt (32); //warte 2 sek     wait 2 seconds 
  }
}

action ampel  // Tis is the Trafficlight Action 
{
  my.event = ampel_event();
}




I wrote some Comments for you in English so you can understand it better .
Posted By: xxxxxxx

Re: [req] simple traffic light w/ red,yellow,green animation - 02/06/11 19:35

Det why do you wrote waitt(960);! It should be wait(-60);
and you forgot () after action ampel!
Sorry for my english!
mfg
xxxxxxx
Posted By: Det

Re: [req] simple traffic light w/ red,yellow,green animation - 02/06/11 19:57

Ich weiß nicht was Du hat der Code läuft 1A zumindest in der A5 lief der Code so wie er da steht das kann man so lassen . Man kann es schon ändern aber ist nicht nötig.

Mußte ihnm in Englisch Antworten
Posted By: xxxxxxx

Re: [req] simple traffic light w/ red,yellow,green animation - 02/06/11 20:07

Ich hab halt A8 und da heißt es wait() und nicht waitt jedenfalls kam mir das noch nie vor und in a8 muss man wenn ma sekunden angeben will ein - davor machen, ansonsten wartet die engine dort soviele frame-zyklen wie man angibt und bei uterschiedlichen frameraten kann die zeit dann variieren! Wenns in a5 leuft is gut esseiden er benutzt kein a5!
mfg
xxxxxxx
Posted By: Det

Re: [req] simple traffic light w/ red,yellow,green animation - 02/06/11 20:19

Nein benutzt er nicht ich vermute A7 oder A8 aber ich hab ihm schon gesagt das er den Code in Lite C Kovertieren muß damit er bei ihm läuft. Und das die Befehle sich gegenüber C Script geändert haben ist ja klar. Lite C soll ja einfacher sein als C Script.Müssen wir eben alle Lite C nehmen in Zukunft .
© 2024 lite-C Forums