• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Camera triggering

Status
Not open for further replies.
Level 6
Joined
Dec 6, 2009
Messages
168
Hi! I didn't know if I should post here or in the trigger section but I have made a 3rd person carmera system and would like to know how to make it so that the camera doesn't go threw terrain like The_Witchers system.

I would also like to know how to make it so that there is no fog or what to call it infront of the character. I have already tried the FarZ option but it didn't work :(

And for my last question I would like to know how to change the height of the camera when I move upwards a mountain because right now it's not really smooth.

I'm using vJass but GUI is totally fine aswell I just want to know how to do it :thumbs_up:
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
I'll move it to Trigger&Scripts if you decided to put up your code.
If not this is the right place for your post.
If you want specific help you should share your code here.

The camera system from the witcher checks multiple times for terrain pathability behind the unit.
If you're familiar with vJass, you could just go through his code, it's no so difficult.
Btw don't reproduce his mistakes in terms of efficiency, like checking for players which do not play at all.
 
Last edited:
Level 6
Joined
Dec 6, 2009
Messages
168
I'm unsure if it is readable but it's a rotating camera system using the arrow keys.
I have tried reading The_Witchers system like 5 times now but I don't get what in it that is checking for terrain hights/ pathing blockers.
I want it so that it can't go threw terrain/ pathing blockers when someone rotates it:eekani:

JASS:
  globals
      integer Cam_Loop
      real CAM_SPEED = 0.10
  endglobals


  function Periodic_Cam_Func takes nothing returns nothing
      set Cam_Loop = 1
      loop
          exitwhen Cam_Loop > 11
          
          call SetCameraTargetControllerNoZForPlayer( ConvertedPlayer(Cam_Loop), Cam_Hero[Cam_Loop], 0.00, 0.00, false )
          call SetCameraFieldForPlayer( ConvertedPlayer(Cam_Loop), CAMERA_FIELD_ZOFFSET, 150.00, 0 )
          if ( CamMoveD[Cam_Loop] == true) then
              set CamAoA[Cam_Loop] = ( CamAoA[Cam_Loop]) + (CamSpeedVertical[Cam_Loop])
              if ( CamAoA[Cam_Loop] ) > ( CamAngleMax[Cam_Loop] ) then
                  set CamAoA[Cam_Loop] = CamAngleMax[Cam_Loop]
              else
              endif
          else
              if ( CamMoveU[Cam_Loop] == true ) then
                  set CamAoA[Cam_Loop] = ( CamAoA[Cam_Loop]) - ( CamSpeedVertical[Cam_Loop])
                  if ( CamAoA[Cam_Loop] ) < ( CamAngleMin[Cam_Loop]) then
                      set CamAoA [Cam_Loop]= CamAngleMin[Cam_Loop]
                  else
                  endif
              else
              endif
          endif
        
        //Fuck it det ser förjävligt ut ändå.
        if ( CamMoveR[Cam_Loop] == true) then
           set CamRotation[Cam_Loop] = ( CamRotation[Cam_Loop]) + ( CamSpeedHorizontal[Cam_Loop])
           if ( CamRotation[Cam_Loop] ) >= ( 360.00 ) then
             set CamRotation[Cam_Loop] = CamRotation[Cam_Loop] - 360.00
           else
           endif
        else
          if ( CamMoveL[Cam_Loop] == true ) then
             set CamRotation[Cam_Loop] = ( CamRotation[Cam_Loop]) - ( CamSpeedHorizontal[Cam_Loop])
             if ( CamRotation[Cam_Loop] ) <= ( 0.00) then
               set CamRotation[Cam_Loop] = ( CamRotation[Cam_Loop]) + 360.00
             else
             endif
          else
          endif
        endif
        
        
        
        
        
        if ( CamOn[Cam_Loop] == true ) then
        call SetCameraFieldForPlayer( ConvertedPlayer(Cam_Loop), CAMERA_FIELD_ANGLE_OF_ATTACK, CamAoA[Cam_Loop], CAM_SPEED )
        call SetCameraFieldForPlayer( ConvertedPlayer(Cam_Loop), CAMERA_FIELD_ROTATION, CamRotation[Cam_Loop], CAM_SPEED )
        else
        endif
        
        set Cam_Loop = Cam_Loop + 1
    endloop
  
  endfunction

//===========================================================================
  function InitTrig_Periodic_Cam_Settings takes nothing returns nothing
      local trigger t = CreateTrigger()
      call TriggerRegisterTimerEventPeriodic( t, 0.03 )
      call TriggerAddAction( t, function Periodic_Cam_Func )
      set t = null
  endfunction
JASS:
scope CamGlobals initializer init

    globals
        unit array Cam_Hero
        real array CamAoA
        real array CamRotation
        
        
        boolean array CamMoveD
        boolean array CamMoveL
        boolean array CamMoveR
        boolean array CamMoveU
        boolean array PressingD
        boolean array PressingL
        boolean array PressingR
        boolean array PressingU
        boolean array CamOn
        real array CamSpeedHorizontal
        real array CamSpeedVertical
        real array CamAngleMin
        real array CamAngleMax
        
        private constant real MIN        = 270.
        private constant real MAX        = 350.
        
        //Hur fort det går
        private constant real HORIZONTAL = 2.
        private constant real VERTICAL   = 2.
        
        private constant real AOA        = 304.
        private constant real ROTATION   = 90.
    endglobals

    private function init takes nothing returns nothing
        //call SetCameraFieldForPlayer( Player(0), CAMERA_FIELD_ZOFFSET, 150.00, 0 )
        //call SetCameraFieldForPlayer( Player(0), CAMERA_FIELD_FARZ, 10000.00, 0 )
        //------------------------\\
        //-----SETUP FOR CAMS-----\\
        //------------------------\\ 
        set CamAoA[1] = AOA
        set CamRotation[1] = ROTATION
        set CamAoA[2] = AOA
        set CamRotation[2] = ROTATION
        set CamAoA[3] = AOA
        set CamRotation[3] = ROTATION
        set CamAoA[4] = AOA
        set CamRotation[4] = ROTATION
        set CamAoA[5] = AOA
        set CamRotation[5] = ROTATION
        set CamAoA[6] = AOA
        set CamRotation[6] = ROTATION
        set CamAoA[7] = AOA
        set CamRotation[7] = ROTATION
        set CamAoA[8] = AOA
        set CamRotation[8] = ROTATION
        set CamAoA[8] = AOA
        set CamRotation[8] = ROTATION
        set CamAoA[9] = AOA
        set CamRotation[9] = ROTATION
        set CamAoA[10] = AOA
        set CamRotation[10] = ROTATION
        set CamAoA[11] = AOA
        set CamRotation[11] = ROTATION
        set CamAoA[12] = AOA
        set CamRotation[12] = ROTATION
        
        set CamOn[1] = false
        set CamOn[2] = false
        set CamOn[3] = false
        set CamOn[4] = false
        set CamOn[5] = false
        set CamOn[6] = false
        set CamOn[7] = false
        set CamOn[8] = false
        set CamOn[9] = false
        set CamOn[10] = false
        set CamOn[11] = false
        // Rotational Speeds
        set CamSpeedHorizontal[1] = HORIZONTAL
        set CamSpeedVertical[1] = VERTICAL
        set CamSpeedHorizontal[2] = HORIZONTAL
        set CamSpeedVertical[2] = VERTICAL
        set CamSpeedHorizontal[3] = HORIZONTAL
        set CamSpeedVertical[3] = VERTICAL
        // Angle of Attack
        set CamAngleMin[1] = MIN
        set CamAngleMax[1] = MAX
        set CamAngleMin[2] = MIN
        set CamAngleMax[2] = MAX
        set CamAngleMin[3] = MIN
        set CamAngleMax[3] = MAX
        set CamAngleMin[4] = MIN
        set CamAngleMax[4] = MAX
        set CamAngleMin[5] = MIN
        set CamAngleMax[5] = MAX
        set CamAngleMin[6] = MIN
        set CamAngleMax[6] = MAX
        set CamAngleMin[7] = MIN
        set CamAngleMax[7] = MAX
        set CamAngleMin[8] = MIN
        set CamAngleMax[8] = MAX
        set CamAngleMin[9] = MIN
        set CamAngleMax[9] = MAX
        set CamAngleMin[10] = MIN
        set CamAngleMax[10] = MAX
        set CamAngleMin[11] = MIN
        set CamAngleMax[11] = MAX
        set CamAngleMin[12] = MIN
        set CamAngleMax[12] = MAX
        
        //Adda flera spelare
        call SelectUnitForPlayerSingle( Player_Unit[1], Player(0) )
        call SelectUnitForPlayerSingle( Player_Unit[2], Player(1) )
        call SelectUnitForPlayerSingle( Player_Unit[3], Player(2) )
    endfunction
endscope
N1TjelI.png
 
Status
Not open for further replies.
Top