I'm playing around with some 3D points and "vectors" in order to make simple animations with Actors using the
Actor - Send message "SetPosition X Y Z" to actor (Actor for Mineral Cart [x, y])
In galaxy code, I want to define the next point (lv_p) along a set path and put the actor there:
ActorSend(ActorFromDoodad(DoodadFromId(649)), libNtve_gf_SetPosition(PointGetX(lv_p), PointGetY(lv_p), PointGetZ(lv_p)));
But as it turns out, there is no standard function called PointGetZ()! The closest thing is PointGetHeight(), but this is relative to the terrain, and not very usefull for defining absolute points in space. Am I missing something basic here, or can somebody point me to a nice workaround?
As far as my knowledge goes you aren't missing something. Whenever you create a map you set its base height which is PointZ 0 and the Z offsets range from BaseHeight +/- 100. So if you created a new map with a 0 base height your Z offset range would be -100 to +100. You need to use your own system to track (already know where its going) and move units/Actors.
You can get a units Z offset from the base height with GetUnitHeight(). Not sure if different height effect that.
PointGetHight() is relative to terrain, and WorldHeight() gives you the terrain height at the specified 2d point. The sum of both should give you the absolute height.
Though, I could be wrong but as far as I know, all the actor messages to set an actor's height don't seem to work. For static heights, Site Operation actors can be used instead...
StragusMapster was right, on his first statement, nonetheless :) I made a function PointGetAbsoluteHeight() that returns the sum of the relative height (of a 3D Point or a unit placed with the editor) PointGetHight() and the height of the terrain underneath WorldHeight().
However, when dealing with points for the Actor Message libNtve_gf_SetPosition() (and vectors in general) I simply use the PointGetHeight() for the Z coordinate, since that function does indeed position actors according to "absolute space".
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I'm playing around with some 3D points and "vectors" in order to make simple animations with Actors using the Actor - Send message "SetPosition X Y Z" to actor (Actor for Mineral Cart [x, y])
In galaxy code, I want to define the next point (lv_p) along a set path and put the actor there: ActorSend(ActorFromDoodad(DoodadFromId(649)), libNtve_gf_SetPosition(PointGetX(lv_p), PointGetY(lv_p), PointGetZ(lv_p)));
But as it turns out, there is no standard function called PointGetZ()! The closest thing is PointGetHeight(), but this is relative to the terrain, and not very usefull for defining absolute points in space. Am I missing something basic here, or can somebody point me to a nice workaround?
As far as my knowledge goes you aren't missing something. Whenever you create a map you set its base height which is PointZ 0 and the Z offsets range from BaseHeight +/- 100. So if you created a new map with a 0 base height your Z offset range would be -100 to +100. You need to use your own system to track (already know where its going) and move units/Actors.
You can get a units Z offset from the base height with GetUnitHeight(). Not sure if different height effect that.
PointGetHight() is relative to terrain, and WorldHeight() gives you the terrain height at the specified 2d point. The sum of both should give you the absolute height.
Though, I could be wrong but as far as I know, all the actor messages to set an actor's height don't seem to work. For static heights, Site Operation actors can be used instead...
StragusMapster was right, on his first statement, nonetheless :) I made a function PointGetAbsoluteHeight() that returns the sum of the relative height (of a 3D Point or a unit placed with the editor) PointGetHight() and the height of the terrain underneath WorldHeight().
However, when dealing with points for the Actor Message libNtve_gf_SetPosition() (and vectors in general) I simply use the PointGetHeight() for the Z coordinate, since that function does indeed position actors according to "absolute space".