-
-
Notifications
You must be signed in to change notification settings - Fork 55
Grid settings
This is a reference documentation on how to set up custom grid in ArcCreate
1. Grid settings
Grid settings can be changed by accessing the Settings
tab within the editor. The following can be customized:
- Grid slot: You can have up to 10 grid slots saved. Grid slots can be quickly accessed with the default keybind
g + [0-9]
. - Use default: Whether or not to use the default grid settings for the current grid slot.
- Lane from: Defines the minimum lane of the ground plane and grid.
- Lane to: Defines the maximum lane of the ground plane and grid.
- Scale with sky input: Whether or not to scale the vertical grid along with the height of sky input line. Useful for charting with enwidencamera active.
- Vertical grid script: A lua script that draws the vertical grid. For more information, refers to section 3.
2. Migrating from Arcade
If you want to keep using the old vertical grid settings format from Arcade editor, an easy way is to use the conversion tool made by recharge-sp
GridConfig = {
X = "-0.5>1.5/0.25", -- Replace with your grid settings
Y = "0>1/0.2;0.5", -- Replace with your grid settings
}
-- // End of config section // --
a="([0-9%.%-]+)>([0-9%.%-]+)/([0-9%.%-]+)"b="Failed to parse:"function c(j)local k={}for l in j:gmatch("[^;]+")do if l:find(">")~=nil then local m=l:gsub(a,"%1")local n=tonumber(m)local o=l:gsub(a,"%2")local p=tonumber(o)local q=l:gsub(a,"%3")local r=tonumber(q)if not(n==nil or p==nil or r==nil)then for s=n,p,r do table.insert(k,s)end else notifyWarning(b..l)end else local m=tonumber(l)if m~=nil then table.insert(k,m)else notifyWarning(b..l)end end end table.sort(k)return k end local d=c(GridConfig.X)local e=c(GridConfig.Y)local f=d[1]local g=d[#d]local h=e[1]if h>-0.2 then h=-0.2 end local i=e[#e]Grid.setCollider(f,g,h,i)for j,k in ipairs(d)do Grid.DrawLine(k,k,h,i)end for j,k in ipairs(e)do Grid.DrawLine(f,g,k,k)end
Simply paste the code above into the grid script field, and replace the X and Y settings with your own settings from Arcade, and your grid should be set up.
The configuration code above has been minified. If you want the readable version, please check out this link: https://github.com/recharge-sp/ArcCreateLuaScripts/blob/trunk/Grid/arcade-grid-compat.lua
3. Vertical grid script
The vertical grid settings is defined through a lua script, similar to custom scenecontrol commands and macros. If you're new or would like a refresher on the language, please refer to the official tutorial for Lua.
All grid drawing is done by accessing methods of grid
object. The following lists all available methods along with usage example
3.1. grid.setCollider(xFrom, xTo, yFrom, yTo)
Description
Define the collider area for the grid, which is a vertical rectangle. The mouse hit can not be detected outside this collider area.
Parameters
Name | Type | Description |
---|---|---|
xFrom |
number | The minimum x value of the collider area |
xTo |
number | The maximum x value of the collider area |
yFrom |
number | The minimum y value of the collider area |
yTo |
number | The maximum y value of the collider area |
Example
-- The standard area for arc and trace notes
grid.setCollider(-0.5, 1.5, 0, 1)
-- Includes y=-0.2, which is where the ground plane is
grid.setCollider(-0.5, 1.5, -0.2, 1)
3.2. grid.setCollider(from, to)
Description
Define the collider area for the grid, which is a vertical rectangle. The mouse hit can not be detected outside this collider area.
This is similar to grid.setCollider(xFrom, xTo, yFrom, yTo)
but uses XY object instead.
Parameters
Name | Type | Description |
---|---|---|
from |
XY | The bottom left corner of the collider area |
to |
XY | The top right corner of the collider area |
Example
-- The standard area for arc and trace notes
local bottomLeft = xy(-0.5, 0) -- an XY object
local topRight = xy(1.5, 1) -- an XY object
grid.setCollider(bottomLeft, topRight)
3.3. grid.setPanelColor(color)
Description
Define background color of the grid area. Uses either a color hex code, an RGBA value or an HSVA value to define the color value (e.g #FFFFFF
).
Parameters
Name | Type | Description |
---|---|---|
color |
string / RGBA / HSVA | The color value |
Example
-- Set the color to transparent
grid.setPanelColor("#000000")
grid.setPanelColor(rgba(0, 0, 0, 0))
grid.setPanelColor(hsva(0, 0, 0, 0))
-- Set the color to translucent white
grid.setPanelColor("#FFFFFF33")
grid.setPanelColor(rgba(255, 255, 255, 51))
grid.setPanelColor(hsva(0, 0, 1, 51))
-- Set the color to translucent red
grid.setPanelColor("#A5423333")
grid.setPanelColor(rgba(165, 66, 51, 51))
grid.setPanelColor(hsva(8, 69, 65, 51))
3.4. grid.drawLine(xFrom, xTo, yFrom, yTo)
Description
Draw a line on the grid between two positions with the default line color.
Parameters
Name | Type | Description |
---|---|---|
xFrom |
number | X coordinate of the first point |
xTo |
number | X coordinate of the second point |
yFrom |
number | Y coordinate of the first point |
yTo |
number | Y coordinate of the second point |
Example
-- Draw a horizontal line at y=-0.2
grid.drawLine(-0.5, 1.5, -0.2, -0.2)
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart
for y=0, 1, 0.25 do
grid.drawLine(-0.5, 1.5, y, y)
end
3.5. grid.drawLine(xFrom, xTo, yFrom, yTo, color)
Description
Draw a line on the grid between two positions with a custom color.
Parameters
Name | Type | Description |
---|---|---|
xFrom |
number | X coordinate of the first point |
xTo |
number | X coordinate of the second point |
yFrom |
number | Y coordinate of the first point |
yTo |
number | Y coordinate of the second point |
color |
string / RGBA / HSVA | The color value |
Example
-- Draw a horizontal line at y=-0.2 with the color red
grid.drawLine(-0.5, 1.5, -0.2, -0.2, "#FF0000FF")
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart with the color red
for y=0, 1, 0.25 do
grid.drawLine(-0.5, 1.5, y, y, hsva(0, 1, 1, 255))
end
3.6. grid.drawLine(from, to)
Description
Draw a line on the grid between two positions with the default line color. Uses XY object.
Parameters
Name | Type | Description |
---|---|---|
from |
XY | The first point's coordinate |
to |
XY | The second point's coordinate |
Example
-- Draw a horizontal line at y=-0.2
grid.drawLine(xy(-0.5, -0.2), xy(1.5, -0.2))
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart
for y=0, 1, 0.25 do
grid.drawLine(xy(-0.5, y), xy(1.5, y))
end
3.7. grid.drawLine(from, to, color)
Description
Draw a line on the grid between two positions with a custom line color. Uses XY object.
Parameters
Name | Type | Description |
---|---|---|
from |
XY | The first point's coordinate |
to |
XY | The second point's coordinate |
Example
-- Draw a horizontal line at y=-0.2
grid.drawLine(xy(-0.5, -0.2), xy(1.5, -0.2))
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart
for y=0, 1, 0.25 do
grid.drawLine(xy(-0.5, y), xy(1.5, y))
end
3.8. grid.drawLineDecorative(xFrom, xTo, yFrom, yTo)
Description
Draw a decorative line on the grid between two positions with the default line color. Decorative lines don't contribute to editing.
Parameters
Name | Type | Description |
---|---|---|
xFrom |
number | X coordinate of the first point |
xTo |
number | X coordinate of the second point |
yFrom |
number | Y coordinate of the first point |
yTo |
number | Y coordinate of the second point |
Example
-- Draw a horizontal line at y=-0.2
grid.drawLine(-0.5, 1.5, -0.2, -0.2)
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart
for y=0, 1, 0.25 do
grid.drawLine(-0.5, 1.5, y, y)
end
3.9. grid.drawLineDecorative(xFrom, xTo, yFrom, yTo, color)
Description
Draw a decorative line on the grid between two positions with a custom color. Decorative lines don't contribute to editing.
Parameters
Name | Type | Description |
---|---|---|
xFrom |
number | X coordinate of the first point |
xTo |
number | X coordinate of the second point |
yFrom |
number | Y coordinate of the first point |
yTo |
number | Y coordinate of the second point |
color |
string / RGBA / HSVA | The color value |
Example
-- Draw a horizontal line at y=-0.2 with the color red
grid.drawLine(-0.5, 1.5, -0.2, -0.2, "#FF0000FF")
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart with the color red
for y=0, 1, 0.25 do
grid.drawLine(-0.5, 1.5, y, y, hsva(0, 1, 1, 255))
end
3.10. grid.drawLineDecorative(from, to)
Description
Draw a decorative line on the grid between two positions with the default line color. Uses XY object. Decorative lines don't contribute to editing.
Parameters
Name | Type | Description |
---|---|---|
from |
XY | The first point's coordinate |
to |
XY | The second point's coordinate |
Example
-- Draw a horizontal line at y=-0.2
grid.drawLine(xy(-0.5, -0.2), xy(1.5, -0.2))
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart
for y=0, 1, 0.25 do
grid.drawLine(xy(-0.5, y), xy(1.5, y))
end
3.11. grid.drawLineDecorative(from, to, color)
Description
Draw a decorative line on the grid between two positions with a custom line color. Uses XY object. Decorative lines don't contribute to editing.
Parameters
Name | Type | Description |
---|---|---|
from |
XY | The first point's coordinate |
to |
XY | The second point's coordinate |
Example
-- Draw a horizontal line at y=-0.2
grid.drawLine(xy(-0.5, -0.2), xy(1.5, -0.2))
-- Draw horizontal lines from y=0 to y=1, spaced 0.25 apart
for y=0, 1, 0.25 do
grid.drawLine(xy(-0.5, y), xy(1.5, y))
end
3.12. grid.drawArea(color, points...)
Description
Draw a polygon area with an abitrary number of points. This is purely decorative.
Parameters
Name | Type | Description |
---|---|---|
color |
string / RGBA / HSVA | The color value |
points |
XY... | Points of the polygon area |
Example
-- Draw safe area for FTR charting
grid.drawArea(rgba(0, 200, 0, 32), xy(-0.5, 0), xy(0, 1), xy(1, 1), xy(1.5, 0))