Polar offset for missile launch

Status
Not open for further replies.
Level 22
Joined
May 16, 2012
Messages
652
Hello Hive!

I'm working on my next Hero Concept and i'm trying to solve a problem related to initial x and y for a missile. I want to be able to adjust the initial x and y coordinates of my missile so it will come out from the barrel of my hero weapon, and for that i'm using a simple polar projection like so:

JASS:
x + 100*Cos(face)
y + 100*Sin(face)

where x and y are my unit current position. The problem, as you can see in the preview below, is that this offset fails. So anyone could give me some ideas on how to make it work like the "Projectile Launch" fields from the Object Editor fields?

Example.gif


Thanks in advance.
 
I'm afraid there's no other way (currently) but to manually put some adjustment to the offset angle like:
JASS:
unitX + barrelLength*Cos(unitFacing + barrelAngleOffset)
unitY + barrelLength*Sin(unitFacing + barrelAngleOffset)
so that it aligns perfectly with the tip of the barrel.
You can make it configurable tho so that it won't be hardcoded atleast, and so that the user has more freedom for using other models.
 
Status
Not open for further replies.
Back
Top