Ardenian
A
Ardenian
I would like to receive some help and advices for creating a decent air movement, please.
I aim to create a system that makes units move automatically, as a plane or spaceship does, for example.
I am aware there are systems for this in the spell section, I do not understand them though,
as I suck at interpreting codes from others.
For now I have this simple function:
It works, more or less.
However, issueing orders to a close point bugs this update function, making the unit rotate around itself, for example.
Is there a better simple way to update a unit's position based on facing ?
I would be glad to receive some advices to the following:
How can I consider an issued order ?
The unit, for example, is ordered to move to a certain point not being part of the upgrade coordinates.
Currently, this does work, but the unit immediatly adjusts its facing.
My idea was to manually adjust it over a certain time t.
However, how would I write a function to make the facing be updated over the whole distance appropriately ?
Do I calculate the angle based on unit facing and ordered point and then calulcate how it long it takes the unit to get there, using that information to update the facing each update ?
Or is there a better way ?
I aim to create a system that makes units move automatically, as a plane or spaceship does, for example.
I am aware there are systems for this in the spell section, I do not understand them though,
as I suck at interpreting codes from others.
For now I have this simple function:
JASS:
globals
real udg_UpdateReal = 8.00
unit udg_TestUnit
endglobals
function UpdatePosition takes nothing returns nothing
local real x = CosBJ(GetUnitFacing(udg_TestUnit))*udg_UpdateReal
local real y = SinBJ(GetUnitFacing(udg_TestUnit))*udg_UpdateReal
call SetUnitX(udg_TestUnit, GetUnitX(udg_TestUnit)+x)
call SetUnitY(udg_TestUnit, GetUnitY(udg_TestUnit)+y)
endfunction
It works, more or less.
However, issueing orders to a close point bugs this update function, making the unit rotate around itself, for example.
Is there a better simple way to update a unit's position based on facing ?
I would be glad to receive some advices to the following:
How can I consider an issued order ?
The unit, for example, is ordered to move to a certain point not being part of the upgrade coordinates.
Currently, this does work, but the unit immediatly adjusts its facing.
My idea was to manually adjust it over a certain time t.
However, how would I write a function to make the facing be updated over the whole distance appropriately ?
Do I calculate the angle based on unit facing and ordered point and then calulcate how it long it takes the unit to get there, using that information to update the facing each update ?
Or is there a better way ?