Skip to content

Commit

Permalink
trails: fix first trail segment not drawn
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoVgr committed Jan 24, 2024
1 parent 41f996f commit 8d99264
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hrt/prefab/l3d/Trails.hx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ class TrailObj extends h3d.scene.Mesh {
var statusText : h2d.Text;

public function addPoint(t : TrailHead, x : Float, y : Float, z : Float, orient : TrailOrientation, w : Float) {

var ux : Float = 0.0;
var uy : Float = 0.0;
var uz : Float = 0.0;
Expand Down Expand Up @@ -710,7 +709,8 @@ class TrailObj extends h3d.scene.Mesh {


if (prev != null ) {
var spd = cur.len / hxd.Math.max((cur.lifetime - prev.lifetime), 1.0/maxFramerate);
var d = new h3d.Vector(prev.x, prev.y, prev.z) - new h3d.Vector(cur.x, cur.y, cur.z);
var spd = d.length() / hxd.Math.max((cur.lifetime - prev.lifetime), 1.0/maxFramerate);
if (spd < prefab.maxSpeed && spd > prefab.minSpeed) {
if (numVertsIndices + 6 > currentAllocatedIndexCount) break;

Expand All @@ -726,7 +726,6 @@ class TrailObj extends h3d.scene.Mesh {

numVertsIndices += 3;
}

}

currentIndex += 2;
Expand Down

0 comments on commit 8d99264

Please sign in to comment.