All Projects → evaera → EvLightning

evaera / EvLightning

Licence: MIT license
EvLightning is a Roblox Lua library. Its purpose is to generate realistic-looking lightning bolts. This could be used to easily add lightning strike effects to any game

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to EvLightning

Aurora
(Deprecated) Aurora is a library that can manage status effects (known as "Auras") in your Roblox game.
Stars: ✭ 23 (-32.35%)
Mutual labels:  roblox, rostrap
Lua-Obfuscator
A Lua Obfuscator made for Roblox, but should work on most Lua applications
Stars: ✭ 84 (+147.06%)
Mutual labels:  roblox
Chrome
This is the source of the Roblox+ Google Chrome extension!
Stars: ✭ 27 (-20.59%)
Mutual labels:  roblox
rojo.space
Rojo website
Stars: ✭ 32 (-5.88%)
Mutual labels:  roblox
Adonis
Roblox Server Administration System
Stars: ✭ 134 (+294.12%)
Mutual labels:  roblox
TopbarPlus
Construct dynamic and intuitive topbar icons. Enhance the appearance and behaviour of these icons with features such as themes, dropdowns and menus.
Stars: ✭ 51 (+50%)
Mutual labels:  roblox
Pyblox
An API wrapper for Roblox written in Python. (Receives Updates)
Stars: ✭ 30 (-11.76%)
Mutual labels:  roblox
roblox-js
!!!THIS PROJECT IS NO LONGER MAINTAINED!!! Execute ROBLOX website actions in node.js
Stars: ✭ 46 (+35.29%)
Mutual labels:  roblox
Adonis 2.0
Roblox Server Administration System
Stars: ✭ 36 (+5.88%)
Mutual labels:  roblox
bypass-captcha-examples
Different complex captcha bypass examples: Steam, Netflix, Data Dome, Adobe, etc.
Stars: ✭ 62 (+82.35%)
Mutual labels:  roblox
ro.py
ro.py is a modern, asynchronous Python 3 wrapper for the Roblox API.
Stars: ✭ 65 (+91.18%)
Mutual labels:  roblox
matter
A modern ECS library for Roblox.
Stars: ✭ 39 (+14.71%)
Mutual labels:  roblox
awesome-roblox
A curated list of ROBLOX resources, plugins and frameworks!
Stars: ✭ 76 (+123.53%)
Mutual labels:  roblox
Flipper
A motion library for Roblox
Stars: ✭ 80 (+135.29%)
Mutual labels:  roblox
Roblox-Miscellaneous
A set of ROBLOX based utilities
Stars: ✭ 21 (-38.24%)
Mutual labels:  roblox
vscode-rojo
Visual Studio Code plugin for Rojo
Stars: ✭ 21 (-38.24%)
Mutual labels:  roblox
Fabric
Fabric provides infrastructure for representing the state of things in your game.
Stars: ✭ 59 (+73.53%)
Mutual labels:  roblox
luacheck-roblox
Luacheck specifications for Roblox Lua
Stars: ✭ 36 (+5.88%)
Mutual labels:  roblox
roact-material
Material design in Roblox w/ Roact!
Stars: ✭ 18 (-47.06%)
Mutual labels:  roblox
StudioComponents
(WIP) Roact implementations of Roblox Studio components.
Stars: ✭ 35 (+2.94%)
Mutual labels:  roblox

EvLightning

EvLightning is a Roblox Lua library that aims to generate realistic-looking lightning bolts. This could be used to easily add lightning strike effects to your game.

Lightning demo

Usage

local LightningBolt = require(path.to.EvLightning)

local myBolt = LightningBolt.new(Vector3.new(0, 400, 0), Vector3.new(0, 0, 0), {
  color = BrickColor.new("Really red");
  -- More options are available, see below...
})
myBolt:Draw(workspace)

A lightning bolt is split into lines, and where the lines meet is considered to be a "bend". At each bend, there is a chance to create a fork, which will create another bolt with its own bends, which in turn have chances to create their own forks, etc. You can control how many bends are in the bolt and the chance of creating a fork at each bend.

API

LightningBolt LightningBolt.new(Vector3 from, Vector3 to[, dictionary options])

Returns an instance of LightningBolt. Automatically generates in the constructor, but further methods must be called on the returned instance to render the bolt.

Options

There are a number of options that you can pass in a third argument to LightningBolt.new in the form of a table dictionary. All options are optional, and have default values.

Option name Description Default value Type
seed A numerical seed which could be used to generate the same lightning bolt across a network. Random Number
bends The number of bends the main bolt should have. 6 Integer
fork_bends The number of bends to put into forks off of the main bolt. 2 Integer
fork_chance The chance to create a new fork off of each bend. (0-100) 50 Number
transparency The transparency of the main bolt. Transparency is reduced at every fork. 0.4 Number
thickness The thickness of the main bolt. Thickness is reduced at every fork. 1 Number
max_depth The maximum depth that forks can reach off the main bolt, which is depth 0. 3 Integer
color The color of the bolt White BrickColor or Color3
material The material of the bolt Enum.Material.Neon Enum.Material
decay The number of seconds for the bolt to exist after being drawn. Infinite Number

Note that the fork_chance option is not an equal chance for every bend in the bolt. The chance is distributed in a gradient down the length of the bolt, meaning that if the fork_chance is 50, then at the very top it will be 0, at the middle it will be 25, and at the very bottom it will be 50. This is done so that less forks are generated towards the top, which makes the bolt look more realistic. If you need to create upwards-forking lightning, then simply reverse the to and from arguments.

void bolt:Draw([Instance parent = Workspace])

Draws the lightning bolt in the world with the given options. An optional argument, parent, can be passed, which will be the parent of the generated lightning bolt parts. If this argument is omitted, there will be a new model created in Workspace containing the bolt parts.

array bolt:GetLines()

Returns a table of tables, containing the line information. The member tables have the keys origin, goal, and depth. This is only necessary if you want to draw the lightning bolt manually (i.e. not calling Draw).

{
	{
		origin 	= Vector3 origin,
		goal 	= Vector3 endpoint,
		depth	= Number depth
	},
	{
		origin 	= Vector3 origin,
		goal 	= Vector3 endpoint,
		depth	= Number depth
	},
	-- ...
}

void bolt:Destroy()

If the lightning bolt has been drawn, this method will destroy the model that was created.

dictionary bolt:GetOptions()

Returns a table of the options that were passed into the constructor. Default values are not applied here.

bool bolt:IsDestroyed()

Returns true if the lightning bolt has either been destroyed or has decayed.

bool bolt:IsDrawn()

Returns true of the Draw method has been called on this particular instance.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].