You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi prime31, I created a small enhancement to the Editor class so we can move the nodes to start at the location of the GameObject where the GoDummyPath is.
I added this script just bellow this script block:
if( GUILayout.Button( "Shift Path to Start at Origin" ) ) { ... }
Here is the code:
// shift the start point to the GameObject where the GoDummyPath is
if (GUILayout.Button("Shift Path to Start at Object"))
{
Undo.RegisterUndo(_target, "Path Vector Changed");
var offset = Vector3.zero;
// see what kind of path we are. the simplest case is just a straight line
var path = new GoSpline(_target.nodes, _target.forceStraightLinePath);
if (path.splineType == SplineType.StraightLine)
offset = _target.transform.position - _target.nodes[0];
else
offset = _target.transform.position - _target.nodes[1];
for (var i = 0; i < _target.nodes.Count; i++)
_target.nodes[i] += offset;
GUI.changed = true;
}
I hope you add this to the branch. I found this very useful to observe the path when creating some spawn nodes in my game and reusing previously saved paths.
You may want to create a method that receives the start position Vector3 as an argument to avoid code duplication in both buttons (Shift Path to Start at Origin and this new one I created)
The text was updated successfully, but these errors were encountered:
Hi prime31, I created a small enhancement to the Editor class so we can move the nodes to start at the location of the GameObject where the GoDummyPath is.
I added this script just bellow this script block:
if( GUILayout.Button( "Shift Path to Start at Origin" ) ) { ... }
Here is the code:
I hope you add this to the branch. I found this very useful to observe the path when creating some spawn nodes in my game and reusing previously saved paths.
You may want to create a method that receives the start position Vector3 as an argument to avoid code duplication in both buttons (Shift Path to Start at Origin and this new one I created)
The text was updated successfully, but these errors were encountered: