--this object will continuously render a line between two different game objectsrefObject1 = Space.Host.GetReference("object1") --Add in References section of Scripting Runtime ComponentrefObject2 = Space.Host.GetReference("object2") --Add in References section of Scripting Runtime ComponentthisObject = Space.Host.ExecutingObjectfunctionOnUpdateFunction() thisObject.LineRenderer.PositionCount =2--this is necessary thisObject.LineRenderer.SetPosition(1,refObject1.WorldPosition) thisObject.LineRenderer.SetPosition(2,refObject2.WorldPosition)endthisObject.OnUpdate(OnUpdateFunction)
--this object will continuously render a line between two different game objectsrefObject1 = Space.Host.GetReference("object1") --Add in References section of Scripting Runtime ComponentrefObject2 = Space.Host.GetReference("object2") --Add in References section of Scripting Runtime ComponentthisObject = Space.Host.ExecutingObjectfunctionOnUpdateFunction() thisObject.LineRenderer.PositionCount =2--this is necessary thisObject.LineRenderer.SetPositions({refObject1.WorldPosition,refObject2.WorldPosition})endthisObject.OnUpdate(OnUpdateFunction)
--the below script will make a slider set both the Line Renderer's Start Width and End WidththisGameObject = Space.Host.ExecutingObjectrefSlider = Space.Host.GetReference("Slider") --Add Reference to Scripting Runtime ComponentrefLineRenderer = Space.Host.GetReference("LineRenderer") --Add Reference to Scripting Runtime ComponentOVC=function()local width = (refSlider.UISlider.Value *5) -- from 0 to 5 refLineRenderer.LineRenderer.SetWidth(width,width)endrefSlider.UISlider.OnValueChanged(OVC)
--clicking the object will open a color picker that changes both Line Renderer's Start Color and End ColorthisGameObject = Space.Host.ExecutingObjectoriginalStartColor = thisGameObject.LineRenderer.StartColororiginalEndColor = thisGameObject.LineRenderer.EndColorOnChange=function(SColor) thisGameObject.LineRenderer.SetColors(SColor,SColor) endOnSelect=function(SColor) thisGameObject.LineRenderer.SetColors(SColor,SColor) endOnCancel=function() thisGameObject.LineRenderer.SetColors(originalStartColor,originalEndColor) endOnClick=function() Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalStartColor)endthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
--clicking this object toggles it's Line Renderer's Motion Vectors (Per Object Motion or Force no motion)thisObject = Space.Host.ExecutingObjectfunctionOnClickFunction() thisObject.LineRenderer.MotionVectors =not thisObject.LineRenderer.MotionVectorsendthisObject.AddClickable()thisObject.Clickable.OnClick(OnClickFunction)
--clicking this object toggles it's Light Probe between Off and Blend ModethisObject = Space.Host.ExecutingObjectfunctionOnClickFunction() thisObject.LineRenderer.UseLightProbes =not thisObject.LineRenderer.UseLightProbesendthisObject.AddClickable()thisObject.Clickable.OnClick(OnClickFunction)
--the below script will make a slider change the Line Renderers start widththisGameObject = Space.Host.ExecutingObjectrefSlider = Space.Host.GetReference("Slider") --Add Reference to Scripting Runtime ComponentrefLineRenderer = Space.Host.GetReference("LineRenderer") --Add Reference to Scripting Runtime ComponentrefSlider.UISlider.Value = refLineRenderer.LineRenderer.StartWidth /2--initial position of sliderOVC=function() refLineRenderer.LineRenderer.StartWidth = (refSlider.UISlider.Value *2) -- from 0 to 2endrefSlider.UISlider.OnValueChanged(OVC)
--the below script will make a slider change the Line Renderer's End WidththisGameObject = Space.Host.ExecutingObjectrefSlider = Space.Host.GetReference("Slider") --Add Reference to Scripting Runtime ComponentrefLineRenderer = Space.Host.GetReference("LineRenderer") --Add Reference to Scripting Runtime ComponentrefSlider.UISlider.Value = refLineRenderer.LineRenderer.EndWidth /2--initial position of sliderOVC=function() refLineRenderer.LineRenderer.EndWidth = (refSlider.UISlider.Value *2) -- from 0 to 2endrefSlider.UISlider.OnValueChanged(OVC)
WidthMultiplier
float WidthMultipliergetset
Set an overall multiplier that is applied to the LineRenderer.widthCurve to get the final width of the line.
--the below script will make a slider change the Line Renderer's Width MultiplierthisGameObject = Space.Host.ExecutingObjectrefSlider = Space.Host.GetReference("Slider") --Add Reference to Scripting Runtime ComponentrefLineRenderer = Space.Host.GetReference("LineRenderer") --Add Reference to Scripting Runtime ComponentrefSlider.UISlider.Value = refLineRenderer.LineRenderer.WidthMultiplier /5--initial position of sliderOVC=function() refLineRenderer.LineRenderer.WidthMultiplier = (refSlider.UISlider.Value *5) -- from 0 to 5endrefSlider.UISlider.OnValueChanged(OVC)
--clicking the object will open a color picker that changes the Line Renderer's Start ColorthisGameObject = Space.Host.ExecutingObjectoriginalColor = thisGameObject.LineRenderer.StartColorOnChange=function(SColor) thisGameObject.LineRenderer.StartColor = SColorendOnSelect=function(SColor) thisGameObject.LineRenderer.StartColor = SColorendOnCancel=function() thisGameObject.LineRenderer.StartColor = originalColorendOnClick=function() Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)endthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
--clicking the object will open a color picker that changes the Line Renderer's End ColorthisGameObject = Space.Host.ExecutingObjectoriginalColor = thisGameObject.LineRenderer.EndColorOnChange=function(SColor) thisGameObject.LineRenderer.EndColor = SColorendOnSelect=function(SColor) thisGameObject.LineRenderer.EndColor = SColorendOnCancel=function() thisGameObject.LineRenderer.EndColor = originalColorendOnClick=function() Space.Dialogues.ColorPicker("title","okbutton", OnChange, OnSelect, OnCancel, originalColor)endthisGameObject.AddClickable()thisGameObject.Clickable.OnClick(OnClick)
--the below script will make a slider change the Line Renderer's Position CountthisGameObject = Space.Host.ExecutingObjectrefSlider = Space.Host.GetReference("Slider") --Add Reference to Scripting Runtime ComponentrefLineRenderer = Space.Host.GetReference("LineRenderer") --Add Reference to Scripting Runtime ComponentrefSlider.UISlider.Value = refLineRenderer.LineRenderer.PositionCount /20--initial position of sliderOVC=function() refLineRenderer.LineRenderer.PositionCount = refSlider.UISlider.Value *20-- from 0 to 20endrefSlider.UISlider.OnValueChanged(OVC)
UseWorldSpace
bool UseWorldSpacegetset
If enabled, the points are considered as world space coordinates. If disabled, they are local to the transform of the GameObject to which this component is attached.
--clicking this object toggles it's Use World Space optionthisObject = Space.Host.ExecutingObjectfunctionOnClickFunction() thisObject.LineRenderer.UseWorldSpace =not thisObject.LineRenderer.UseWorldSpaceendthisObject.AddClickable()thisObject.Clickable.OnClick(OnClickFunction)
Loop
bool Loopgetset
Enable this to connect the first and last positions of the line, and form a closed loop.
--the below script will make a slider change the Line Renderer's Corner VerticesthisGameObject = Space.Host.ExecutingObjectrefSlider = Space.Host.GetReference("Slider") --Add Reference to Scripting Runtime ComponentrefLineRenderer = Space.Host.GetReference("LineRenderer") --Add Reference to Scripting Runtime ComponentrefSlider.UISlider.Value = refLineRenderer.LineRenderer.NumCornerVertices /10--initial position of sliderOVC=function() refLineRenderer.LineRenderer.NumCornerVertices = refSlider.UISlider.Value *10-- from 0 to 10endrefSlider.UISlider.OnValueChanged(OVC)
NumCapVertices
int NumCapVerticesgetset
Set this to a value greater than 0, to get rounded corners on each end of the line.
--the below script will make a slider change the Line Renderer's End Cap VerticesthisGameObject = Space.Host.ExecutingObjectrefSlider = Space.Host.GetReference("Slider") --Add Reference to Scripting Runtime ComponentrefLineRenderer = Space.Host.GetReference("LineRenderer") --Add Reference to Scripting Runtime ComponentrefSlider.UISlider.Value = refLineRenderer.LineRenderer.NumCapVertices /20--initial position of sliderOVC=function() refLineRenderer.LineRenderer.NumCapVertices = refSlider.UISlider.Value *20-- from 0 to 10endrefSlider.UISlider.OnValueChanged(OVC)
TextureMode
int TextureModegetset
Control how the Texture is applied to the line. (0-3)