HumanExpel
New Member
- Reaction score
- 0
Alrighty, So I'm in attempts to make an RPG. I'm using an uber simple JASS script for the camera right now and want to customize it and make it, well, more RPG-like.
My current set up only allows zooming, turning and locking onto the character I specify. It does not react to Z-CoOrd changes, which, of coarse, gets annoying when going up a hill and you end up with the camera going through the ground.
Heres the code:
Initialize Camera Code
Camera Setup
Those are the two main cameras. I don't really believe I need to include the 8 other codes as all they do is rotate the camera/stop rotating the camera.
Does anyone have any tutorials that help with this, or know how to get the camera to react to the characters z-position? (I'm very new to JASS)
My current set up only allows zooming, turning and locking onto the character I specify. It does not react to Z-CoOrd changes, which, of coarse, gets annoying when going up a hill and you end up with the camera going through the ground.
Heres the code:
Initialize Camera Code
Code:
function InitTrig_InitCamera takes nothing returns nothing
call CameraSetupApply(gg_cam_Cam, false, false)
call SetCameraTargetController(gg_unit_Hpal_0000, 0, 0, true)
set udg_Zoom = GetCameraField(CAMERA_FIELD_TARGET_DISTANCE)
set udg_Rotation = GetUnitFacing(gg_unit_Hpal_0000)
endfunction
Camera Setup
Code:
function Trig_CameraTrigger_Actions takes nothing returns nothing
if (udg_RightPressed == true) then
set udg_Rotation = udg_Rotation+10
endif
if (udg_LeftPressed == true) then
set udg_Rotation = udg_Rotation-10
endif
if (udg_UpPressed == true) then
set udg_Zoom = udg_Zoom-50
if (udg_Zoom < 300) then
set udg_Zoom = udg_Zoom+50
endif
endif
if (udg_DownPressed == true) then
set udg_Zoom = udg_Zoom+50
if (udg_Zoom > 850) then
set udg_Zoom = udg_Zoom-50
endif
endif
call SetCameraField(CAMERA_FIELD_ROTATION, udg_Rotation, 0.10)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, udg_Zoom, 0.10)
endfunction
//===========================================================================
function InitTrig_CameraTrigger takes nothing returns nothing
set gg_trg_CameraTrigger = CreateTrigger( )
call TriggerRegisterTimerEvent(gg_trg_CameraTrigger, 0.10, true)
call TriggerAddAction( gg_trg_CameraTrigger, function Trig_CameraTrigger_Actions )
endfunction
Those are the two main cameras. I don't really believe I need to include the 8 other codes as all they do is rotate the camera/stop rotating the camera.
Does anyone have any tutorials that help with this, or know how to get the camera to react to the characters z-position? (I'm very new to JASS)