This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
4rpl:commands:movetowardsandavoid [2022/03/31 21:31] – [Description] Corrected mention broadening of MoveTowards API's Vertu | 4rpl:commands:movetowardsandavoid [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 6: | Line 6: | ||
===== Description ===== | ===== Description ===== | ||
- | Takes a starting 3D position (a vector) and generates a new 3D position that is moved towards the target (a vector). The resulting point will not be displaced more than the delta argument. | + | Takes a starting 3D position (a 3-vector) and generates a new 3D position that is moved towards the target (also a 3-vector). The resulting point will not be displaced more than the delta argument. |
+ | * The delta is simply the speed (in cells) this unit moves per game frame. | ||
* The minHeight argument restricts how close, height wise, the resulting point can be to the terrain and/or creeper. | * The minHeight argument restricts how close, height wise, the resulting point can be to the terrain and/or creeper. | ||
* The checkRange argument is an integer that specifies how many cells outward to inspect when enforcing the minHeight. | * The checkRange argument is an integer that specifies how many cells outward to inspect when enforcing the minHeight. | ||
* The checkCreeper argument is a Boolean indicating whether to look at creeper for enforcing the minHeight. | * The checkCreeper argument is a Boolean indicating whether to look at creeper for enforcing the minHeight. | ||
* The checkAC argument is a Boolean indicating whether to look at anticreeper for enforcing the minHeight. | * The checkAC argument is a Boolean indicating whether to look at anticreeper for enforcing the minHeight. | ||
- | * The checkPseudoTerrain argument is a Boolean indicating whether to look at invisible pseudo terrain (like a shield creates) for enforing | + | * The checkPseudoTerrain argument is a Boolean indicating whether to look at invisible pseudo terrain (like a shield creates) for enforcing |
- | + | ||
- | : | + | |
- | This API and [[MoveTowardsCellAndAvoid]] have " | + | |
- | Imagen that all MoveTowards API's create a 3-Vector version of the provided delta as (Dx Dy Dz) while in the process of calculating the next position. The sum of all 3 vectors (without allowing subtraction to occur) will be equal to the originally provided delta. For this API and [[MoveTowardsCellAndAvoid]], | + | |
- | If Dy > 0, the unit will rise vertically.\\ | + | |
- | If Dy < 0, the unit will fall until it reaches < | + | |
- | The resulting Dy will be the vertical change of the unit at any time. So if your <-delta was 0.5 and the vector of direction was perfectly and only upwards, the V3 delta would be (0 0.4 0) and cause your unit to move upwards at a rate of 0.4 cells per frame. | + | |
===== Examples ===== | ===== Examples ===== | ||
<code 4rpl> | <code 4rpl> |