- Joined
- Nov 7, 2014
- Messages
- 571
Using 3d points within World Editor
The Warcraft III [The Frozen Throne]'s map editor (WE, World Editor) has a tool palette from which the Terrain Palette, Doodad Palette, Unit Palette, Region Palette and the Camera Palette can be accesed.
This means that WE has first class support for terraining, doodads, units, regions and cameras, but no points, unlike the Starcraft 2 map editor.
With that said, we can repurpose one of the tool palette's objects and turn it into a 3d point. The one that I think is best suited is the Camera object.
We can see the camera objects within WE when the Camera Palette is active or when the View/Camera Objects setting is enabled. We can turn a camera into a 3d point by changing a few of it's properties:
The important ones are: Target X, Target Y, Z Offset, Angle of Attack (AoA) and Distance. I recommend that you use 270.00 for AoA and 100 for distance this would make the camera point downwards and make it small.
The Target X, Taget Y and Z Offset would of course be our point's X, Y and Z coordinates respectively.
When we create a camera object with the Camera Palette, WE will make it accessable to us by generating some Jass2 code:
We can see that cameras are represented by the type
The way we can get the x, y and z coordinates from the camera object is:
And there you have it, 3d points within WE which have first class spupport and are easy to use via script.
The Warcraft III [The Frozen Throne]'s map editor (WE, World Editor) has a tool palette from which the Terrain Palette, Doodad Palette, Unit Palette, Region Palette and the Camera Palette can be accesed.
This means that WE has first class support for terraining, doodads, units, regions and cameras, but no points, unlike the Starcraft 2 map editor.
With that said, we can repurpose one of the tool palette's objects and turn it into a 3d point. The one that I think is best suited is the Camera object.
We can see the camera objects within WE when the Camera Palette is active or when the View/Camera Objects setting is enabled. We can turn a camera into a 3d point by changing a few of it's properties:
The important ones are: Target X, Target Y, Z Offset, Angle of Attack (AoA) and Distance. I recommend that you use 270.00 for AoA and 100 for distance this would make the camera point downwards and make it small.
The Target X, Taget Y and Z Offset would of course be our point's X, Y and Z coordinates respectively.
When we create a camera object with the Camera Palette, WE will make it accessable to us by generating some Jass2 code:
JASS:
globals
camerasetup gg_cam_Top_of_Mountain = null
endglobals
function CreateCameras takes nothing returns nothing
set gg_cam_Top_of_Mountain = CreateCameraSetup()
call CameraSetupSetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_ZOFFSET, 0.0, 0.0)
call CameraSetupSetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_ROTATION, 90.0, 0.0)
call CameraSetupSetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_ANGLE_OF_ATTACK, 270.0, 0.0)
call CameraSetupSetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_TARGET_DISTANCE, 100.0, 0.0)
call CameraSetupSetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_ROLL, 0.0, 0.0)
call CameraSetupSetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_FIELD_OF_VIEW, 120.0, 0.0)
call CameraSetupSetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_FARZ, 101.0, 0.0)
call CameraSetupSetDestPosition(gg_cam_Top_of_Mountain, 439.0, 306.5, 0.0)
endfunction
We can see that cameras are represented by the type
camerasetup
. Also note the name of the global variable that WE assigned to our camera: it is the one we used in the Camera Palette but space characters were replaced by underscores and it has the prefix: gg_cam_The way we can get the x, y and z coordinates from the camera object is:
JASS:
globals
location loc = Location(0.0, 0.0)
real px
real py
real pz
endglobals
...
set px = CameraSetupGetDestPositionX(gg_cam_Top_of_Mountain)
set py = CameraSetupGetDestPositionY(gg_cam_Top_of_Mountain)
call MoveLocation(loc, px, py)
set pz = CameraSetupGetField(gg_cam_Top_of_Mountain, CAMERA_FIELD_ZOFFSET) + GetLocationZ(loc)
...
And there you have it, 3d points within WE which have first class spupport and are easy to use via script.