Giant Camera Attempt

Users who are viewing this thread

Leikeze

Sergeant at Arms
I'm trying to code a camera script for giants. I am not sure if it's even possible. Any ideas?

Code:
giant_camera = (
      0, 0, 0, [
      (get_player_agent_no, ":player_agent"),
      ],
        [
              (mission_cam_set_mode,0,0,0),
              (mission_cam_set_mode,1,0,0),
              (get_player_agent_no, ":player_agent"),
              (mission_cam_set_target_agent, ":player_agent", 1),
              (agent_get_position, pos2,":player_agent"),
              (position_set_x, pos1, pos2),
              (position_set_y, pos1, pos2),
              (position_set_z, pos1, pos2+300),
              (mission_cam_set_position, pos1),
           ])
 
As you surely alredy noticed camera in programmable mode wont respond to mouse movement on normal means. Yes, its possible, but you must code mouse support yourself (or whatever camera controll scheme you planning to use for giants ).
 
Leikeze said:
I am not sure if it's even possible. Any ideas?

sure thingy. You can check VC modsys if you want a example.

VC has a mode for a "bird view" camera, or strategic camera, with the camera high above ground. You use it normally in combat, and you can switch between normal camera (character) or bird with a simple keystroke (shortcut)

Q&A thread is the place to ask questions btw, most modders don't check other posts and you will be missing out  :mrgreen:. Also a good place to use forum search to look for old answers.
 
Thanks. I'll check it out.

--edit--

It seems the module system download link for VC is dead.
 
Thanks but I ended up finding something similar in brytenwalda.
I tried reworking brytenwalda's death_camera but the camera seems to move incorrectly rotating around the x axis.

Code:
deathcam_mouse_deadzone = 2

giant_camera = (
   0, 0, 0,
   [
      (neg|is_presentation_active, "prsnt_battle"),
      (mouse_get_position, pos1),
      (set_fixed_point_multiplier, 1000),
      (position_get_x, reg1, pos1),
      (position_get_y, reg2, pos1),
   ],
   [
      (mission_cam_set_mode, 1, 0, 0),
      # fix for windowed mode: recenter the mouse
      (assign, ":continue", 1),
      (try_begin),
        (eq, reg1, "$camera_mouse_x"),
        (eq, reg2, "$camera_mouse_y"),
        (val_add, "$camera_mouse_counter", 1),
        (try_begin), #hackery: if the mouse hasn't moved for X cycles, recenter it
          (gt, "$camera_mouse_counter", 50),
          (assign, "$camera_mouse_center_x", reg1),
          (assign, "$camera_mouse_center_y", reg2),
          (assign, "$camera_mouse_counter", 0),
        (try_end),
        (assign, ":continue", 0),
      (try_end),

      (assign, "$camera_mouse_counter", 0), # reset recentering hackery

      # update recorded mouse position
      (assign, "$camera_mouse_x", reg1),
      (assign, "$camera_mouse_y", reg2),
     
      (mission_cam_get_position, pos47),
      (get_player_agent_no, ":player_agent"),
      (agent_get_position, pos5, ":player_agent"),
      (position_get_x, ":pos_x", pos5),
      (position_get_y, ":pos_y", pos5),
      (position_get_z, ":pos_z", pos5),
      (position_set_x, pos47, ":pos_x"),
      (position_set_y, pos47, ":pos_y"),
      (position_set_z, pos47, ":pos_z"),
      (position_move_z, pos47, 250),
      (store_sub, ":shift", "$camera_mouse_center_x", reg1), #horizontal shift for pass 0
      (store_sub, ":shift_vertical", reg2, "$camera_mouse_center_y"), #for pass 1
     
      (try_for_range, ":pass", 0, 2), #pass 0: check mouse x movement (left/right), pass 1: check mouse y movement (up/down)
        (try_begin),
          (eq, ":pass", 1),
          (assign, ":shift", ":shift_vertical"), #get ready for the second pass
        (try_end),
        (this_or_next|lt, ":shift", -deathcam_mouse_deadzone), #skip pass if not needed (mouse deadzone)
        (gt, ":shift", deathcam_mouse_deadzone),
       
        (assign, ":sign", 1),
        (try_begin),
          (lt, ":shift", 0),
          (assign, ":sign", -1),
        (try_end),
        # square root calc
        (val_abs, ":shift"),
        (val_sub, ":shift", deathcam_mouse_deadzone), # ":shift" is now 1 or greater
        (convert_to_fixed_point, ":shift"),
        (store_sqrt, ":shift", ":shift"),
        (convert_from_fixed_point, ":shift"),
        (val_clamp, ":shift", 1, 6), #limit rotation speed
        (val_mul, ":shift", ":sign"),
        (try_begin),
          (eq, ":pass", 0), # rotate around z (left/right)
          (store_mul, ":minusrotx", "$camera_rotx", -1),
          (position_rotate_x, pos47, ":minusrotx"), #needed so camera yaw won't change
          (position_rotate_z, pos47, ":shift"),
          (position_rotate_x, pos47, "$camera_rotx"), #needed so camera yaw won't change
        (try_end),
        (try_begin),
          (eq, ":pass", 1), # rotate around x (up/down)
          (position_rotate_x, pos47, ":shift"),
          (val_add, "$camera_rotx", ":shift"),
        (try_end),
      (try_end), #try_for_range ":pass"
      (mission_cam_set_position, pos47),
   ]
)
 
Back
Top Bottom