• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Fix my camera!

Status
Not open for further replies.
Level 12
Joined
Mar 10, 2008
Messages
869
Hi,
I have a kind of, first person camera, and I need to make it so it's like the first picture, all the way through the game even with the ups and downs of the terrain...
First Pic:
attachment.php


Getting a bit higher there...
attachment.php


TOO HIGH!
attachment.php


Here's my trigger:
  • SetCamera
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CameraGroup and do (Actions)
        • Loop - Actions
          • Set CamPoint = (Position of (Picked unit))
          • Custom script: set udg_CamHeight = GetLocationZ(udg_CamPoint)
          • Set CamHeight2 = (CamHeight x 0.75)
          • Camera - Set (Owner of (Picked unit))'s camera Height Offset to (75.00 + (CamHeight - CamHeight2)) over 0.50 seconds
          • Custom script: call RemoveLocation(udg_CamPoint)
          • Camera - Set (Owner of (Picked unit))'s camera Distance to target to 500.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Angle of attack to 325.00 over 0.50 seconds
          • Camera - Pan camera for (Owner of (Picked unit)) to (Position of (Picked unit)) over 0.00 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Field of view to 550.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Rotation to (Facing of (Picked unit)) over 0.50 seconds
I want to try and prevent using lock camera because i want to be able to right click on the minimap and ping wherever on the minimap.
 

Attachments

  • Cam1.JPG
    Cam1.JPG
    42.2 KB · Views: 522
  • Cam2.JPG
    Cam2.JPG
    93.6 KB · Views: 568
  • Cam3.JPG
    Cam3.JPG
    68.5 KB · Views: 584
Level 19
Joined
Oct 29, 2007
Messages
1,184
Try these two custom scripts inside your trigger:

JASS:
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), -0.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), 0.01)

Z equals to the Z height of your units current position.
You can se A to whatever number you want to higher of lower the veiw height.

By the way, you leak a unit group. You should set the unit group to a variable and then remove it afterwards.
You also leak a location: "Camera - Pan camera for (Owner of (Picked unit)) to (Position of (Picked unit)) over 0.00 seconds".
 
Level 19
Joined
Oct 29, 2007
Messages
1,184
  • Actions
    • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), -0.01)
    • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), 0.01)
"Z" is the height of the terrain you unit is located at. In case you saved it as a variable just replace "Z" with "udg_something". (The varible name.)
 
Level 12
Joined
Mar 10, 2008
Messages
869
manstie, you can only bump once every 48hours, you first double posted and then bumped twice in a day...

I DID wait 48 hours, even though the bumping time is ACTUALLY 24 hours. God! USE YOUR EYES!

11-02-2009, 01:41 PM First Post
Yesterday, 10:35 AM Second Post
Yesterday = 11-04-2009
It goes MM DD YYYY not DD MM YYYY, if that is why you acted like an idiot.

  • Actions
    • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), -0.01)
    • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), 0.01)
"Z" is the height of the terrain you unit is located at. In case you saved it as a variable just replace "Z" with "udg_something". (The varible name.)
I meant add it into my trigger... but fine, I'll figure it out ... T_T
 
Last edited:
Level 12
Joined
Mar 10, 2008
Messages
869
Bump.
I tried those custom scripts.
Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), -0.01)
Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + Z - GetCameraTargetPositionZ + A(), 0.01)

These are mine:
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ + 75(), -0.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ + 75(), 0.01)
It says "Expected '('"
and in NewGen it says "syntax error"
 
Last edited:
JASS:
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, 0.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, 0.01)

JASS:
constant native GetCameraTargetPositionZ    takes nothing returns real

Its a function, you missed the ()
 
Last edited:
Level 12
Joined
Mar 10, 2008
Messages
869
Wait wait wait, so if my trigger is this:
  • SetCamera
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CameraGroup and do (Actions)
        • Loop - Actions
          • Set CamPoint = (Position of (Picked unit))
          • Custom script: set udg_CamHeight = GetLocationZ(udg_CamPoint)
          • Camera - Set (Owner of (Picked unit))'s camera Height Offset to CamHeight over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Distance to target to 500.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Angle of attack to 500.00 over 0.50 seconds
          • Camera - Pan camera for (Owner of (Picked unit)) to CamPoint over 0.00 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Field of view to 550.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Rotation to (Facing of (Picked unit)) over 0.50 seconds
          • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ + 75(), -0.01)
          • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ + 75(), 0.01)
          • Custom script: call RemoveLocation(udg_CamPoint)
Then what the hell do I do?

If i replace mine with
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75(), 0.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75(), 0.01)
then it says Expected '
 
Just add
  • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, 0.01)
  • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, 0.01)
Its not random shit, its jass and is obviously your answer.
If you are not willing to learn from your mistakes, I can't see why I should help you further.
 
Level 12
Joined
Mar 10, 2008
Messages
869
Ok those last 2 that u gave me worked now. Ty.

EDIT: The camera is upside down now.
  • SetCamera
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CameraGroup and do (Actions)
        • Loop - Actions
          • Set CamPoint = (Position of (Picked unit))
          • Custom script: set udg_CamHeight = GetLocationZ(udg_CamPoint)
          • Camera - Set (Owner of (Picked unit))'s camera Height Offset to CamHeight over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Distance to target to 500.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Angle of attack to 500.00 over 0.50 seconds
          • Camera - Pan camera for (Owner of (Picked unit)) to CamPoint over 0.00 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Field of view to 550.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Rotation to (Facing of (Picked unit)) over 0.50 seconds
          • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, 0.01)
          • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, -0.01)
          • Custom script: call RemoveLocation(udg_CamPoint)
How to make it un-upside down?

EDIT: Heres a pic.
upsidedowncamera.png
 
Last edited:
  • Camera - Set (Owner of (Picked unit))'s camera Distance to target to 500.00 over 0.50 seconds
  • Camera - Set (Owner of (Picked unit))'s camera Angle of attack to 500.00 over 0.50 seconds
  • Camera - Pan camera for (Owner of (Picked unit)) to CamPoint over 0.00 seconds
  • Camera - Set (Owner of (Picked unit))'s camera Field of view to 550.00 over 0.50 seconds
you know that the maximum value is 359,99?
 
Level 12
Joined
Mar 10, 2008
Messages
869
Those never effected it before. Look at my first post.

Well, It's fixed now:
  • SetCamera
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CameraGroup and do (Actions)
        • Loop - Actions
          • Set CamPoint = (Position of (Picked unit))
          • Custom script: set udg_CamHeight = GetLocationZ(udg_CamPoint)
          • Camera - Set (Owner of (Picked unit))'s camera Height Offset to CamHeight over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Distance to target to 500.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Angle of attack to 320.00 over 0.50 seconds
          • Camera - Pan camera for (Owner of (Picked unit)) to CamPoint over 0.00 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Field of view to 500.00 over 0.50 seconds
          • Camera - Set (Owner of (Picked unit))'s camera Rotation to (Facing of (Picked unit)) over 0.50 seconds
          • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, 0.02)
          • Custom script: call SetCameraField(CAMERA_FIELD_ZOFFSET, GetCameraField(CAMERA_FIELD_ZOFFSET) + udg_CamHeight - GetCameraTargetPositionZ() + 75, 0.02)
          • Custom script: call RemoveLocation(udg_CamPoint)
Only Angle of Attack has max of 360

workingcamera.png
 
Last edited:
Status
Not open for further replies.
Top