Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path follow 3D returning different vectors in new beta build snapshot. #51342

Closed
aquietmonk opened this issue Aug 7, 2021 · 2 comments · Fixed by #51357
Closed

Path follow 3D returning different vectors in new beta build snapshot. #51342

aquietmonk opened this issue Aug 7, 2021 · 2 comments · Fixed by #51357

Comments

@aquietmonk
Copy link

Godot version

3.4-beta3

System information

Windows 10

Issue description

The following code in 3.3.2 Stable works fine and returns sensible vectors:

func getPathDirection(position):
var _offset = _trackPath.curve.get_closest_offset(position)
_tackPathFollow.offset = _offset
return _tackPathFollow.transform.basis.z

Using the same code in 3.4-beta3 presents different vectors! These are used for directing my AI characters so it is funny to see them get confused and drive off in apparently random ways, but obviously not ideal.

Here are a small collection of vectors from this function running in 3.3.2:

Chosen Direction: (0.977867, 0.010528, -0.208961)
Chosen Direction: (0.97787, 0.010528, -0.208949)
Chosen Direction: (0.977907, 0.010628, -0.20877)
Chosen Direction: (0.978013, 0.010929, -0.208258)
Chosen Direction: (0.978215, 0.011506, -0.207275)
Chosen Direction: (0.978537, 0.012402, -0.205698)
Chosen Direction: (0.978995, 0.013633, -0.203426)
Chosen Direction: (0.979563, 0.015069, -0.200574)
Chosen Direction: (0.980218, 0.016591, -0.197225)
Chosen Direction: (0.980944, 0.018104, -0.193447)

Here are the same ones from the same AI on the same level in 3.4-beta:
Chosen Direction: (-0.999867, -0.013116, 0.009671)
Chosen Direction: (-0.999867, -0.013115, 0.00969)
Chosen Direction: (-0.999866, -0.013215, 0.009691)
Chosen Direction: (-0.999862, -0.013517, 0.009655)
Chosen Direction: (-0.999854, -0.014096, 0.009661)
Chosen Direction: (-0.999841, -0.014996, 0.00967)
Chosen Direction: (-0.999821, -0.016237, 0.009685)
Chosen Direction: (-0.999797, -0.017688, 0.009686)
Chosen Direction: (-0.999768, -0.019232, 0.009716)
Chosen Direction: (-0.999737, -0.020774, 0.009761)

Obviously in order for my AI characters to perform as expected the vectors returned must be predictable. Attached is a screenshot of the path follow panel.
Panel

Steps to reproduce

Create a path on a 3d plane and place an object in the scene that passes its global position with:

getPathDirection(global_transform.origin)

Run this in 3.3.2-stable and compare the returned vector to 3.4-beta3 to see a different vector.

Minimal reproduction project

No response

@akien-mga
Copy link
Member

That's likely due to #50986, CC @raulsntos.

@raulsntos
Copy link
Member

Sorry about that, I missed a subtraction in that PR, should be fixed with #51357 and #51358

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants