[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > StarCraft II > StarCraft II Editor Help Zone


StarCraft II Editor Help Zone Tell us about any problem you have ran into while using Starcraft II's editor ("Galaxy Editor") be it with a malfunctioning trigger or an issue with the complex Data Editor. If you need help on creating a trigger or system, you may also ask here!

Closed Thread
 
Thread Tools
Old 02-13-2012, 08:40 AM   #1 (permalink)
Registered User BlueBerryWizard
Clan Blue FTW!
 
BlueBerryWizard's Avatar
 
Join Date: Aug 2007
Posts: 320
BlueBerryWizard has little to show at this moment (29)BlueBerryWizard has little to show at this moment (29)BlueBerryWizard has little to show at this moment (29)
Bug AngleBetweenPoints Function Stops Working on Points that have a Height

When I set the height of a point
Jass:
PointSetHeight(point a, fixed height);
then try to use
Jass:
AngleBetweenPoints(point a, point b);
The AngleBetweenPoints function no longer works and always returns 0. :(

Why does it do this? To work around it I had to get the angle between the points before I set the height of the points. x.x
__________________
Alliances System v1.2Farming Simulation Beta 1LOAF


Projects & Resources
BlueBerryWizard is offline  
Old 02-13-2012, 02:21 PM   #2 (permalink)
Registered User Daelin
Kelani mage
 
Daelin's Avatar
 
Join Date: Jul 2004
Posts: 3,385
Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)
Former Staff Member: This user used to be on the Hive Workshop staff. Special Effect Contest #1 - Winner: Frozen Effects 
This works just fine for me.
Jass:
lv_p1 = Point(0.0,0.0);
lv_p2 = Point(2.5,5.0);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, FixedToText(AngleBetweenPoints(lv_p1,lv_p2), c_fixedPrecisionAny));
PointSetHeight(lv_p1, 3.14);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, FixedToText(AngleBetweenPoints(lv_p1,lv_p2), c_fixedPrecisionAny));
PointSetHeight(lv_p2, 7.12);
UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, FixedToText(AngleBetweenPoints(lv_p1,lv_p2), c_fixedPrecisionAny));
__________________


Daelin is offline  
Old 02-13-2012, 04:28 PM   #3 (permalink)
Registered User Dr Super Good
Imperial Good
 
Dr Super Good's Avatar
 
Join Date: Jan 2005
Posts: 15,178
Dr Super Good has been here far too long (2588)Dr Super Good has been here far too long (2588)Dr Super Good has been here far too long (2588)Dr Super Good has been here far too long (2588)
Merit Badge - Level 0: This user has proven to be extremely valuable to the Warcraft III Modding Community. User of the Year: 2010 
Do make sure that both points you are using exist. It is very easy to accidenly lose track of references so you end up comparing a point with null (which probably would yield this behaviour).

Additionally, the function mechanics might not consider the Z demention (only X/Y) so trying to compare the angle of 2 points which only have different Z positions may result in this behaviour.
Dr Super Good is offline  
Old 02-13-2012, 04:52 PM   #4 (permalink)
Registered User Daelin
Kelani mage
 
Daelin's Avatar
 
Join Date: Jul 2004
Posts: 3,385
Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)Daelin is a glorious beacon of light (584)
Former Staff Member: This user used to be on the Hive Workshop staff. Special Effect Contest #1 - Winner: Frozen Effects 
It does work that way. This function places the two points in a polar coordinates system (radius and angle). The resulting system is in fact centered in the first point, and the function computes the angle coordinate of the second point (with the Z coordinates ignored upon the translation).

In 3D, the problem is obviously expanded to three dimensions - more specifically a spherical coordinate system (radius, elevation angle, and azimuth angle). Because of the two distinct angles, separate functions would be needed to compute their values, with the radius remaining the classical euclidean distance between the two (the Azimuth Angle is the same as the 2D angle).

The Wiki article on the subject is very neat, and offers much more information, including conversion formulas (just in case you need something like this for your 3D solution).
__________________


Daelin is offline  
Closed Thread

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 11:32 AM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle