11:58 oranges !dm var/x = 371.3 % 360.0; world.log << x;;
11:58 Bot32 oranges: 11
python example
370.5 % 360
10.5
This would be useful to have for pixel projectiles and etc where that extra decimal value makes a difference over longer ranges and causes deflections
Otherwise we have to manually subtract 360 until it's normalised within the 360-0 range
ID:2250559
May 24 2017, 5:05 pm
|
|||||||
| |||||||
May 24 2017, 5:09 pm
|
|
I realise we can work around this by figuring out the diff between the item and the rounded item and then readding it at the end, but it would be a nice convenience to have.
|
Here's how I clamp (normalize?) angles:
angle + round(-angle, 360) // (-180, 180] Also, this is a duplicate: http://www.byond.com/forum/?post=1664849 |
Also, pixel projectiles work better by scaling the vector from source to target, eliminating the need for angles in most cases.
|
In response to Optimumtact
|
|
Optimumtact wrote:
I don't search because byond forum search is sucky, but good spotting There's always Google. |
In response to Kaiochao
|
|
I agree but unfortunately our implementation is usually just an angle of travel calculated by the vector between the source and target which is then discarded.
The use case for this is calculating the angle of incidence for reflections |