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

Steering by vector broke in version 0.6 #54

Closed
Dunbaratu opened this issue Sep 16, 2013 · 1 comment
Closed

Steering by vector broke in version 0.6 #54

Dunbaratu opened this issue Sep 16, 2013 · 1 comment

Comments

@Dunbaratu
Copy link
Contributor

I posted about this in the forum but it's a critical bug that broke every script I wrote that worked on 0.5 and I can't find a workaround so I'm posting it here to be sure it gets seen as soon as possible.

This syntax used to work:
lock steering to up + V(x,y,z).
or this:
lock steering to up * V(x,y,z).

They are no longer supported, it seems. They now cause "Expression error" to try to use a V(...) expression to steer by.

This is critical because now all the available means to steer require that you know the angles ( you can use R() or Q() or HEADING... BY... ) and to get the angles from the vector XYZ lengths requires access to the functions arcsin, arccos, or arctan, which we don't have.

Either of the following two things would solve the problem:
1 - Put support for steering by a vector back in.
or
2 - Add arcsin, arccos, and arctan.

For example, the compass heading and pitch could be derived as follows if we had the arc functions, assuming X is north, Y is west, and Z is up:

set xyzLength to (x^2+y^z+z^2)^0.5 .
set xyLength to (x^2 * y^2) ^ 0.5 .
set compSin to (0-x) / xyLength.
set compCos to y / xyLength.
set compass to arccos( compCos ).
if compSin < 0 { set compass to 0 - compass. }.
set pitchSin to z / xyzLen .
set pitch to arcsin( pitchSin ).
lock steering to heading compass by pitch.

@Dunbaratu
Copy link
Contributor Author

I have tried this in the rushed-through 0.61 bugfix update and it seems to be working again so I'll close this. Thanks for the fast fix.

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

No branches or pull requests

1 participant