minor fixes
This commit is contained in:
parent
5432879e81
commit
80c061b527
2 changed files with 21 additions and 26 deletions
|
|
@ -28,7 +28,7 @@ class Trail {
|
||||||
static distance_based{false}
|
static distance_based{false}
|
||||||
|
|
||||||
#doc="Add a trail modifier to an entity. Entity should also have a Transform."
|
#doc="Add a trail modifier to an entity. Entity should also have a Transform."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity to add the trail modifier to."
|
entity = "The entity to add the trail modifier to."
|
||||||
)
|
)
|
||||||
static create(entity: Entity): None {
|
static create(entity: Entity): None {
|
||||||
|
|
@ -36,7 +36,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Remove the trail modifier from an entity."
|
#doc="Remove the trail modifier from an entity."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity to remove the trail modifier from."
|
entity = "The entity to remove the trail modifier from."
|
||||||
)
|
)
|
||||||
static destroy(entity: Entity): None {
|
static destroy(entity: Entity): None {
|
||||||
|
|
@ -44,7 +44,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Check whether an entity has a trail modifier or not."
|
#doc="Check whether an entity has a trail modifier or not."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity to check whether it has a trail modifier."
|
entity = "The entity to check whether it has a trail modifier."
|
||||||
)
|
)
|
||||||
static has(entity: Entity): Bool {
|
static has(entity: Entity): Bool {
|
||||||
|
|
@ -52,7 +52,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Reset trail to no length."
|
#doc="Reset trail to no length."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static reset(entity: Entity): None {
|
static reset(entity: Entity): None {
|
||||||
|
|
@ -60,7 +60,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Set the width of a trail."
|
#doc="Set the width of a trail."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier.",
|
entity = "The entity with the trail modifier.",
|
||||||
width = "The new width of the trail."
|
width = "The new width of the trail."
|
||||||
)
|
)
|
||||||
|
|
@ -69,7 +69,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Get the width of a trail."
|
#doc="Get the width of a trail."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static get_width(entity: Entity): Num {
|
static get_width(entity: Entity): Num {
|
||||||
|
|
@ -77,7 +77,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Set the length of a trail."
|
#doc="Set the length of a trail."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier.",
|
entity = "The entity with the trail modifier.",
|
||||||
length = "The new length of the trail."
|
length = "The new length of the trail."
|
||||||
)
|
)
|
||||||
|
|
@ -87,7 +87,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Get the length of a trail."
|
#doc="Get the length of a trail."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static get_length(entity: Entity): Num {
|
static get_length(entity: Entity): Num {
|
||||||
|
|
@ -101,7 +101,7 @@ class Trail {
|
||||||
Trail.set_time_based(entity, Trail.distance_based)
|
Trail.set_time_based(entity, Trail.distance_based)
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier.",
|
entity = "The entity with the trail modifier.",
|
||||||
time_based = "`true` if its time based, `false` if its distance based."
|
time_based = "`true` if its time based, `false` if its distance based."
|
||||||
)
|
)
|
||||||
|
|
@ -112,7 +112,7 @@ class Trail {
|
||||||
#doc="""
|
#doc="""
|
||||||
Get whether the trail is time based or distance based. (true if time based, false if distance based)
|
Get whether the trail is time based or distance based. (true if time based, false if distance based)
|
||||||
"""
|
"""
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static get_time_based(entity: Entity): Bool {
|
static get_time_based(entity: Entity): Bool {
|
||||||
|
|
@ -124,7 +124,7 @@ class Trail {
|
||||||
If the UVs are normalized, they should be linear over distance,
|
If the UVs are normalized, they should be linear over distance,
|
||||||
especially with time based trails you otherwise can get very wobbly behaviour as speed changes.
|
especially with time based trails you otherwise can get very wobbly behaviour as speed changes.
|
||||||
"""
|
"""
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier.",
|
entity = "The entity with the trail modifier.",
|
||||||
length = "Whether the trail should have normalized uvs."
|
length = "Whether the trail should have normalized uvs."
|
||||||
)
|
)
|
||||||
|
|
@ -133,7 +133,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Get whether a trail has normalized uvs."
|
#doc="Get whether a trail has normalized uvs."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static get_normalize_uvs(entity: Entity): Bool {
|
static get_normalize_uvs(entity: Entity): Bool {
|
||||||
|
|
@ -141,7 +141,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Set the material the trail is rendered with via its id."
|
#doc="Set the material the trail is rendered with via its id."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static set_material_id(entity: Entity, material_id: String): None {
|
static set_material_id(entity: Entity, material_id: String): None {
|
||||||
|
|
@ -151,7 +151,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Set the material the trail is rendered with."
|
#doc="Set the material the trail is rendered with."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static set_material(entity: Entity, material: Material): None {
|
static set_material(entity: Entity, material: Material): None {
|
||||||
|
|
@ -162,7 +162,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Get the id of the currently used material."
|
#doc="Get the id of the currently used material."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static get_material_id(entity: Entity): String {
|
static get_material_id(entity: Entity): String {
|
||||||
|
|
@ -173,7 +173,7 @@ class Trail {
|
||||||
Set mesh subdivisions around length of the trail.
|
Set mesh subdivisions around length of the trail.
|
||||||
This will rebuild the mesh entirely and potentially throw away custom materials you set via `set_material`.
|
This will rebuild the mesh entirely and potentially throw away custom materials you set via `set_material`.
|
||||||
"""
|
"""
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier.",
|
entity = "The entity with the trail modifier.",
|
||||||
subdivisions = "Subdivisions along length."
|
subdivisions = "Subdivisions along length."
|
||||||
)
|
)
|
||||||
|
|
@ -183,7 +183,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Get subdivisions in length of trail."
|
#doc="Get subdivisions in length of trail."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static get_subdivisions_length(entity: Entity): Num{
|
static get_subdivisions_length(entity: Entity): Num{
|
||||||
|
|
@ -194,7 +194,7 @@ class Trail {
|
||||||
Set mesh subdivisions around length of the trail.
|
Set mesh subdivisions around length of the trail.
|
||||||
This will rebuild the mesh entirely and potentially throw away custom materials you set via `set_material`.
|
This will rebuild the mesh entirely and potentially throw away custom materials you set via `set_material`.
|
||||||
"""
|
"""
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier.",
|
entity = "The entity with the trail modifier.",
|
||||||
subdivisions = "Subdivisions along width."
|
subdivisions = "Subdivisions along width."
|
||||||
)
|
)
|
||||||
|
|
@ -204,7 +204,7 @@ class Trail {
|
||||||
}
|
}
|
||||||
|
|
||||||
#doc="Get subdivisions in width of trail."
|
#doc="Get subdivisions in width of trail."
|
||||||
#args=(
|
#args(
|
||||||
entity = "The entity with the trail modifier."
|
entity = "The entity with the trail modifier."
|
||||||
)
|
)
|
||||||
static get_subdivisions_width(entity: Entity): Num{
|
static get_subdivisions_width(entity: Entity): Num{
|
||||||
|
|
@ -442,8 +442,8 @@ class TrailSystem is ModifierSystem {
|
||||||
each{|entity, data: ModifierData|
|
each{|entity, data: ModifierData|
|
||||||
if(!Transform.has(entity)) return
|
if(!Transform.has(entity)) return
|
||||||
|
|
||||||
start = Transform.local_point_to_world(entity, 0, data.edge_length * -0.5, 0)
|
var start = Transform.local_point_to_world(entity, 0, data.edge_length * -0.5, 0)
|
||||||
end = Transform.local_point_to_world(entity, 0, data.edge_length * 0.5, 0)
|
var end = Transform.local_point_to_world(entity, 0, data.edge_length * 0.5, 0)
|
||||||
Draw.path3D(_draw, [start, end], _debug_edge_style, false)
|
Draw.path3D(_draw, [start, end], _debug_edge_style, false)
|
||||||
}
|
}
|
||||||
Draw.commit(_draw)
|
Draw.commit(_draw)
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,6 @@ class Game is Ready {
|
||||||
Trail.reset(_blade)
|
Trail.reset(_blade)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Input.key_state_released(Key.key_1)) {
|
|
||||||
var subs = Trail.get_subdivisions_length(_blade) + 5
|
|
||||||
Trail.set_subdivisions_length(_blade, subs)
|
|
||||||
}
|
|
||||||
|
|
||||||
//app.color.r = app.color.g = app.color.b = (IO.timestamp()/20 % 1)
|
//app.color.r = app.color.g = app.color.b = (IO.timestamp()/20 % 1)
|
||||||
//System.print(1/delta)
|
//System.print(1/delta)
|
||||||
} //tick
|
} //tick
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue