01-06-2016, 12:35 AM
(This post was last modified: 01-06-2016, 09:02 PM by Trainzland.)
(01-05-2016, 06:28 PM)Jake Wrote: SplineController.Spline.Interpolate(SplineController.RelativePosition).
Your example returns the local position of the of the origin spline position. Not the WorldPosition.
(01-05-2016, 06:28 PM)Jake Wrote: Alternatively, add this to CurvyController.cs (currently untested, but should do the trick):
Yes and no.
Yes, after Apply() the internal SplineController.transfrom.position returns the WorldPosition. Okay this is great anyway.
No, the transform of the GameObject itself does not updated after UPDATE(current frame) has finished.
Example:
Code:
using UnityEngine;
using System.Collections;
using FluffyUnderware.DevTools;
using UnityEngine.UI;
using FluffyUnderware.Curvy.Controllers;
using FluffyUnderware.Curvy;
public class TestSplinePosition : MonoBehaviour {
public SplineController Spline;
public int f = 0;
// Use this for initialization
void Start() {
Spline = this.GetComponent<SplineController>();
}
// Update is called once per frame
void Update() {
if (f == 0) {
Spline.AbsolutePosition = 5;
Spline.Apply();
if (Spline.transform.position.x != 0) {
Debug.Log("Updated to Spline.transform.position =" + Spline.transform.position.x);
}
}
f++;
}
}
1) The SplineController.Position is internally updated but the real GameObject is not!
2) After Spline.AbsolutePosition = 5; Spline.Apply(); is executed in 2 additional Frames (1 - 2 and 3) then the GO will updated.
Code:
using UnityEngine;
using System.Collections;
using FluffyUnderware.DevTools;
using UnityEngine.UI;
using FluffyUnderware.Curvy.Controllers;
using FluffyUnderware.Curvy;
public class TestSplinePosition : MonoBehaviour {
public SplineController Spline;
public int f = 0;
// Use this for initialization
void Start() {
Spline = this.GetComponent<SplineController>();
}
// Update is called once per frame
void Update() {
if (f == 0 || f == 1 || f == 2) {
Spline.AbsolutePosition = 5;
Spline.Apply();
if (Spline.transform.position.x != 0) {
Debug.Log("Updated to Spline.transform.position =" + Spline.transform.position.x);
}
}
f++;
}
}
Example:
The cube is at position 0,0,0 and the SC own position 5,0,0 while unity play.
(Henry Ford) Each hour more of searching is each hour less of your live time.