Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / how to do that a traffic light works

Author
Message
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 26th Oct 2011 05:39
Hi, I have the mesh, but I don't know how to do it works. I think to load 3 mesh (each with red on, others off, yellow on, others off and green on, others off), hide the meshes that I don't occupy, then, I am hiding and discovering for cycle since I need. But I don't know how to write the code (times on and off). Any suggestion will be valued well. Thank in advance
nonZero
13
Years of Service
User Offline
Joined: 10th Jul 2011
Location: Dark Empire HQ, Otherworld, Silent Hill
Posted: 26th Oct 2011 09:50
I'm not sure if I understand what you are asking, but I assume you mean this:

You have a 3D model of a traffic light. You want the lights to change red green orange red green orange...etc.

I think rather than hiding/showing 3 different big meshes, load one traffic light sans any bulbs and 1 small lightbulb mesh per light (ie the traffic light body is seperate from the 3 bulbs). Then simply swap textures on each bulb's meshes. Make the two Off ones a dark-coloured version of your texture for that colour and make On one the light coloured version.

chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Oct 2011 03:21
You could do something like a timer . Have a look.



Cheers.

I'm not a grumpy grandpa
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 27th Oct 2011 10:29
Yees, Cheers!, your code works very fine. I made the adjustments to what I'm going programming and is perfect. If I want to work five objects in the street, remember that the green light turns on in sequence as I go along, should you have any idea as to modify the code to work that way? Thanks for your help, really.
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Oct 2011 13:04
You can add as many traffic lights as you need, but all of them have to operates with the timer.



Cheers.

I'm not a grumpy grandpa
Manchu
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Here! of course
Posted: 28th Oct 2011 19:08
Chafari, thanks for your help, I test your code now

Login to post a reply

Server time is: 2024-11-22 12:34:26
Your offset time is: 2024-11-22 12:34:26