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

goto function interruption #1655

Open
eschan146 opened this issue Apr 21, 2024 · 2 comments
Open

goto function interruption #1655

eschan146 opened this issue Apr 21, 2024 · 2 comments

Comments

@eschan146
Copy link

I have noticed that when I run an object's goto function, it runs continuously until the object reaches its destination. However, I want it to stop within sixty meters of the target to shoot it, but that means pausing the function mid-execution. Is there a way I can implement this?

Thank you.

@tomangelo2
Copy link
Member

Get a point near destination with space() function. Adjust min and max parameters to suit your needs, then goto() to that point. Might not work in all cases, but this will be easiest solution.

@eschan146
Copy link
Author

I used some vector math for this instead:

point direction_vector (target.position.x - position.x,
						target.position.y - position.y,
						target.position.z - position.z);
point normalized_vector = normalize(direction_vector);
point destination (target.position.x - normalized_vector.x * proximity,
					target.position.y - normalized_vector.y * proximity,
					target.position.z - normalized_vector.z * proximity);

and then use flatspace and find an area around it

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

2 participants