• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Polar offset for missile launch

Status
Not open for further replies.
Level 21
Joined
May 16, 2012
Messages
644
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.
 

AGD

AGD

Level 16
Joined
Mar 29, 2016
Messages
688
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.
Top