瀏覽代碼

Spline: fix moving parent object not updating samples values

lviguier 5 月之前
父節點
當前提交
699863aecc
共有 1 個文件被更改,包括 16 次插入1 次删除
  1. 16 1
      hrt/prefab/l3d/Spline.hx

+ 16 - 1
hrt/prefab/l3d/Spline.hx

@@ -14,6 +14,19 @@ enum SplineShape {
 	Cubic;
 	Cubic;
 }
 }
 
 
+class SplineObject extends h3d.scene.Object {
+	public var spline : Spline;
+
+	public function new(parent: h3d.scene.Object) {
+		super(parent);
+	}
+
+	override function calcAbsPos() {
+		super.calcAbsPos();
+		@:privateAccess spline.samples = null;
+	}
+}
+
 class SplinePoint {
 class SplinePoint {
 	public static var DEFAULT_TAN_LENGTH = 3.0;
 	public static var DEFAULT_TAN_LENGTH = 3.0;
 
 
@@ -196,7 +209,9 @@ class Spline extends hrt.prefab.Object3D {
 
 
 	override function makeObject(parent3d: h3d.scene.Object) : h3d.scene.Object {
 	override function makeObject(parent3d: h3d.scene.Object) : h3d.scene.Object {
 		#if editor graphics = null; #end
 		#if editor graphics = null; #end
-		return super.makeObject(parent3d);
+		var splineObject = new SplineObject(parent3d);
+		splineObject.spline = this;
+		return splineObject;
 	}
 	}
 
 
 	override function updateInstance(?propName : String ) {
 	override function updateInstance(?propName : String ) {