Returns the speed factor of a given path's given position.


path_get_speed(ind, pos);

Argument Description
index The index of the path to check.
pos How far through the path to check. Between 0 (start) and 1 (end), can be decimal.

Returns: Real.


This function returns the speed factor of any given position on a path. The position should be a value between 0 and 1 (you can use path_position, for example, if you need the current position of the instance) with 0 being the start position and 1 being the end. The value returned will be the factor by which the actual path_speed is being set. For example, on a path with only two points, 0 and 1, where the point 0 speed factor is 100 and point 1 speed factor is 0, the function path_get_speed(path, 0.5) will return 50.


speed = path_get_speed(path0, 0.5) / 20;

This will set the calling instance's speed to the speed factor of the point at exactly halfway through path0, divided by 20. So if the speed factor found is the default 100, it will set the speed of the calling instance to 5.

Back: Path Information
Next: path_get_x
© Copyright YoYo Games Ltd. 2015 All Rights Reserved