• 🏆 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!

UnitGetPosition and UnitSetPosition

Status
Not open for further replies.
Level 23
Joined
Nov 29, 2006
Messages
2,482
Good day!
Since I did not find the proper place to discuss galaxy code I guess I go here for a starter.

Anyways, I did some research about these to natives. And I think this is something Blizzard forgot to think of.

UnitGetPosition returns a point for sure. But what may be most important thing is: What does the point contain?

The point returned contains the x, y and facing of the unit. But why not the z (height)?

UnitSetPosition sets a unit's point. But this will only set the x and y coordinates.


I know, there are natives which do everything, eg set the xy, height and facing, but why the inconsistency? It just slightly bothers me.

~ Eccho ~
 
Level 2
Joined
Apr 15, 2006
Messages
19
My guess is that it is because you generally don't want to set the height when moving it to another position. Otherwise, one would need to set the height of the point to the height of the unit before setting the unit position, which would get pretty annoying.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
I do agreed, for basic stuff. But for all custom things you want to do in galaxy, as example a car racing game or a projectile physics game everything is most likely going to be changing each possible frame.
But allowing a point to have a facing does not add up either, because I noticed more stuff which makes it pointless to use them.
(I know, the title should be speaking about points in it's entirely, not just about those two natives)


say I have 2 points P1 and P2
For each test I assume that

P1.x = 1
P1.y = 2
p1.height = 2
p1.facing = 90

p2.x = 2
p2.y = 2
p2.height = 1
p1.facing = 40

Say the following experiments using their operators which they /say/ should work.
p1 = p2 // Will work, all values of p2 is now in p1
p1 + p2 // Only x and y coordinates will be computed, the point returned will have a height of 0 and facing of -90
p1 - p2 // Same as previous but with subtraction
Say, using the native PointSet which sets a point p1 to another point p2 (should do the same as p1 = p2?)
PointSet(p1, p2) // p1 will get new x and y coordinates, height and facing is forgotten.

So yeah, it is annoying that you really can't use these operators either on points, because they are not fully implemented.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
I said that as an example. Point being, if I would want to make something "realistic" or custom with scripting in sc2, there is no other option. And by frame by frame I did mean a periodic timer of an interval of like 0.065, but yeah that is irrelevant.
 
Status
Not open for further replies.
Top