Jump to content

Nav lights scripting


Recommended Posts

That could work, as a quick fix... If I can figure out how particles work, and where they\'re spat out at, and so forth...

Ultimately, when the scripting is added (providing I know how, or can get help) I want to make them toggleable between 4 or so modes with a button (Slow strobe, Fast strobe, Constant, or Off) on each ship (if possible). So, I\'m crossing my fingers and waiting for now...

Link to comment
Share on other sites

You might want to look into the new module loading feature that was just added. I suspect it could be used to do exactly what you want. It might not be completely implementable right now since it was only just added, but I would imagine it\'s exactly what you would use to do it.

Cheers!

Capt\'n Skunky

KSP Community Manager

Link to comment
Share on other sites

Okay, so I\'ve made a few navigation lights.

How would one go about starting to script them for strobing and such?

What I did for the flashing red lights on my new Range Safety Devices:



// Set up light
base.gameObject.AddComponent<Light>();
base.gameObject.light.color = Color.red;
onIntensity=base.gameObject.light.intensity;
base.gameObject.light.intensity=0;

Then, in onActiveFixedUpdate, I have


// Every other second, toggle the light.
if (Time.time % 2 == 0)
{
base.gameObject.light.intensity = (base.gameObject.light.intensity == onIntensity) ? 0f : onIntensity;
}

http://unity3d.com/support/documentation/ScriptReference/Light.html

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...