Page 1 of 2

I now notice why?/how? you love maths... but...

Posted: Mon Dec 14, 2009 7:11 am
by manstie
Hello...
Just came back to post something...
I'm recently learning about using Sine, Cosine and Tangent, but I have no idea where people would use it in life... I guess I was partially wrong :roll:
I noticed that you used *Cos(0.017453278*GetUnitFacing(u) and *Sin(0.017453278*GetUnitFacing
I'd like to know, how did you get 0.017453278?

I'd also like to know what is Atan2? (In "Information for Dummies" talk)



And is there a way to increase the turn speed of your system (It won't turn any faster from like... 0.5 turning speed to 1 turning speed).

Re: I now notice why?/how? you love maths... but...

Posted: Mon Dec 14, 2009 8:57 am
by 3ICE
0.017453278 is a magic constant: π/180 Pi/180 is used for converting degrees (°) to radians ().

Computer games need a lot of trigonometry for distance calculations, collision detection, etc. A secretary or a lawyer will never need Sine, Cosine, or Tangent, but a programmer needs this stuff for sure.

Atan2 is on wikipedia. The first paragraph tells you everything you need to know about it. (takes two arguments, x and y, then in a coordinate system calculates the angle between the X axis and the (x;y) point and returns it in radians. I'd draw your a picture, but I'm 5$ not 10$ motivated 15$ enough 20$.

I have nothing on how to make them turn faster. I think all sliding maps have this problem. If you know of any map (protection isn't a problem) that has quicker turns on ice, I'd love to steal that and implement it into my system as a new variable (udg_TurningSpeed).

Re: I now notice why?/how? you love maths... but...

Posted: Mon Dec 14, 2009 10:40 am
by samtre
the most thing a lot of warcraft map makers have in common is MATH!

it seems it's an addiction as they make systems and custom abilities....i still don't know how to use JASS, but i am able to make JASS spells using gui but with a lot of equations...
i still don't know how to use the other 'Math - ' actions.....

can't you try something like " call SetUnitFacing( GetEnumUnit(), ( GetUnitFacing(GetEnumUnit()) + udg_TurningSpeed ))"?
i tried this thing on my own maps and worked okay, i just removed the "Timed" before "SetUnitFacing" and ", 0.00 " before "udg_TurningSpeed )) ", i've never tried using in on your map..... don't dare to.

Re: I now notice why?/how? you love maths... but...

Posted: Mon Dec 14, 2009 1:32 pm
by 3ICE
I am already using that*, but it is no good.

*=call SetUnitFacing(u,57.295828*Atan2(GetLocationY(p)-y,GetLocationX(p)-x))

Btw what you have there would spin the unit like crazy, making the player feel slightly out of control :P

Re: I now notice why?/how? you love maths... but...

Posted: Tue Dec 15, 2009 3:59 am
by manstie
Yeah...
A map with a faster turn speed (I think, pretty sure the triggers make them turn a bit faster) is Area of Ice Escape 4. (I noticed in Area of Ice Escape 1 that the turn speed wasn't as fast as #4.)
I was thinking - Wouldn't it be impossible to change the turn speed without a trigger that sets a unit's facing point instantly?

I just thought of another thing - Maybe you could do a custom thing to unit facing degreese, and don't use that at all, but use a real value to replace Unit facing degreese, and just make the unit face degreese for show :)

Re: I now notice why?/how? you love maths... but...

Posted: Tue Dec 15, 2009 12:22 pm
by 3ICE
You make absolutely no sense. SetUnitFacing is the function that sets the unit's facing "instantly". If only it did...

Re: I now notice why?/how? you love maths... but...

Posted: Wed Dec 16, 2009 12:02 am
by samtre
i think he meant by as you order a unit to move(slide) to a point, instantly changes the unit facing from the unit's position to the point

or

it is just what i said

or
Wouldn't it be impossible to change the turn speed without a trigger that sets a unit's facing point instantly?
i just think of this as
Would it be possible
,
maybe just by changing the unit's turning speed, i remembered you(3ICE) said that your Steer trigger is somehow based on the unit's turning speed

and at the last sentence, why make a custom trigger for unit's facing degrees that we don't use at all? unit's facing degrees uses Real

Re: I now notice why?/how? you love maths... but...

Posted: Wed Dec 16, 2009 4:18 am
by manstie
samtre wrote:i think he meant by as you order a unit to move(slide) to a point, instantly changes the unit facing from the unit's position to the point

or

it is just what i said

or
Wouldn't it be impossible to change the turn speed without a trigger that sets a unit's facing point instantly?
i just think of this as
Would it be possible
,
maybe just by changing the unit's turning speed, i remembered you(3ICE) said that your Steer trigger is somehow based on the unit's turning speed

and at the last sentence, why make a custom trigger for unit's facing degrees that we don't use at all? unit's facing degrees uses Real
But with that real, you can't set it instantly to something else, it eases into the direction. So if you make a custom variable and change that, it's instant.

Re: I now notice why?/how? you love maths... but...

Posted: Wed Dec 16, 2009 8:33 am
by samtre
How about Unit - Move Unit instantly and Face Angle?
this might be dumb.........
you can't use any abilities though.

Re: I now notice why?/how? you love maths... but...

Posted: Wed Dec 16, 2009 9:50 am
by 3ICE
This is making less and less sense the deeper we go into it. Especially because you guys keep suggesting things I already use.

EDIT: It would have been great to have this discussion in two separate topics:
I now notice why?/how? you love maths and How to make sliding units turn faster?