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

Change weight at the point in AStar #12434

Closed
Timofffee opened this issue Oct 27, 2017 · 3 comments
Closed

Change weight at the point in AStar #12434

Timofffee opened this issue Oct 27, 2017 · 3 comments

Comments

@Timofffee
Copy link
Contributor

Please add the weight change to a previously created point at AStar.
Something like this

// AStar node
void AStar::set_point_weight(int p_id, float p_weight_scale)  
{
     points[p_id]->weight_scale = p_weight_scale;
}
# GDscript code
AStar.set_point_weight(id, weight)
@mhilbrunner
Copy link
Member

mhilbrunner commented Oct 27, 2017

I'll send a PR for this later today if nobody else did it by then.

Note that currently, you could use AStar:add_point() for this. If the point you give to add_point() already exists, it just updates it's position and weight_scale. This doesn't seem to be documented yet, however, so I'll include that. :)

@ghost
Copy link

ghost commented Oct 27, 2017

Is this #6531?

@mhilbrunner
Copy link
Member

@Noshyaar As far as I can see, no. To quote that issue:

1. have a set_weight_scale(int point_id) function
2. have a set_custom_weigth_calculator(object, string function_name)
   func function_name(int point_from, int_point_to)

The PR only added the second one, while this is asking for the first one again, like that issue :)
Not hard to implement however, if I'm not missing anything.

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

No branches or pull requests

3 participants