Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | wooshuwu |
Every tutorial I’ve seen for PathFollow nodes (both 2D and 3D) says to just change the offset of the PathFollow node to move the node along the path (which should be its parent if I understand correctly). That works when manually changing the value of the offset in the inspector, however when I run the following code:
public override void _Ready()
{
Testing = GetNode<PathFollow>("Path2/Path2Follow");
Testing.Offset = 0.0f;
}
public override void _Process(float delta)
{
if(Input.IsActionJustPressed("Increase")){
Testing.Offset += OffsetAmt;
GD.Print($"increase: {Testing.Offset}");
}
if(Input.IsActionJustPressed("Decrease")){
Testing.Offset -= OffsetAmt;
GD.Print("decrease");
}
}
with the input actions assigned in the project input map (to arrow keys), the print statement says the offset is NaN.
This is my scene setup:
Am I missing something or doing something wrong? All I need it to do is be able to move an object along a path (3d) node either backwards or forwards, depending on an input value. Additional information can be given and any help is appreciated.