• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Polar offset for missile launch

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