• 🏆 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!

First person cam goes low height near river/lower terrain. Is there any way to avoid this?

Status
Not open for further replies.
Level 3
Joined
Oct 1, 2022
Messages
12
Basically title , i tried to set height to a fixed amount and current height of my unit . (Its locked to my Unit)

But both times , the cam height goes lower once you are near water..

I would understand it if my unit would go INTO the water but just going near the water is enough for my cam to lose height ,which makes any kind of river/water pretty bad in a first person cam scenario..

Is there a way to fix this?
 
Level 19
Joined
Jan 3, 2022
Messages
320
Do you mean this situation, where if you go down on a slope, the camera will get closer to terrain? Did I understand you correctly, do you actually use a First-Person cam or Third-Person camera?
camera-on-slope.png

You said it's fixed to your unit, I suggest you create a debug code where: 1. your camera code is disabled 2. a dummy unit will be moved/placed at X,Y coords where you click with the mouse and the same height Z as your camera code. This is to test and see for yourself how it all works. I don't know whether you've found a bug, a feature or "works as expected".
 
Level 3
Joined
Oct 1, 2022
Messages
12
Hi sry for late reply , no there is no slope at all , the whole map is flat.

This is not from my map but https://www.hiveworkshop.com/media/world-of-warcraft-models-in-reforged.129431/full?d=1585833069

The 2 guards standing at the ship , at that spot my cam height would go lower because its near the water. Its like im in the lower terrain of the water , even tho im actually at the spot where the guards are.

My "first person cam" looks like this (its just gui)

---
Trigger 1

Map Int

Lock camera target for P1 to Blood mage

Trigger 2

Every 0.1 seconds of game time

Set cam height offset to 150 over 0.00 secs
Set distance to target to 10 over 0.00 secs
Set Far Z zo 20000 over 0.00 secs
Set Angle of attack to 350 0.00 secs
Set Rotation to facing angle of Blood mage over 0.20 secs
---

And i removed blood mages model so i dont see him at all.

".a dummy unit will be moved/placed at X,Y coords where you click with the mouse and the same height Z as your camera code."

Unfortunetly i dont understand this , what do you mean by " you click with the mouse" ?
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
".a dummy unit will be moved/placed at X,Y coords where you click with the mouse and the same height Z as your camera code."

Unfortunetly i dont understand this , what do you mean by " you click with the mouse" ?
Luashine is suggesting you do something like this:
  • Mouse Test
    • Events
      • Player - Player 1 (Red) issues Mouse Down event
    • Conditions
    • Actions
      • Special Effect - Destroy CamEffect
      • Set VariableSet CamPoint = (Mouse Position for Triggered Mouse Event) //this point leaks but it's for a test so it doesn't matter
      • Special Effect - Create a special effect at CamPoint using Abilities\Weapons\WitchDoctorMissile\WitchDoctorMissile.mdl
      • Set VariableSet CamEffect = (Last created special effect)
      • Special Effect - Set Position - Z of CamEffect to YOUR_CAMERA_HEIGHT
Whenever you click, a special effect will be created where you clicked at the height of YOUR_CAMERA_HEIGHT (whatever you set that to). This will allow you to determine if the camera actually lower down near the water, or something else is interfering. The created effect should be at the height of the camera.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
I think you want something like this:
  • Camera Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet CameraPoint = (Center of (Playable map area))
      • Set VariableSet CameraHero = Paladin 0001 <gen>
      • Camera - Lock camera target for Player 1 (Red) to CameraHero, offset by (0.00, 0.00) using The unit's rotation
      • Camera - Set Player 1 (Red)'s camera Far Z to 20000.00 over 0.00 seconds
      • Animation - Change CameraHero's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
  • Camera Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Custom script: call SetCameraZ(150.00 + GetHeroZ())
      • Camera - Set Player 1 (Red)'s camera Distance to target to 10.00 over 0.00 seconds
      • Camera - Set Player 1 (Red)'s camera Angle of attack to 350.00 over 0.00 seconds
      • Camera - Set Player 1 (Red)'s camera Rotation to (Facing of CameraHero) over 0.20 seconds
SetCameraZ() and GetHeroZ() require this code:
vJASS:
//Toadcop's Method:
function SetCameraZ takes real z returns nothing
    set z = GetCameraField(CAMERA_FIELD_ZOFFSET)+z-GetCameraTargetPositionZ()
    call SetCameraField(CAMERA_FIELD_ZOFFSET,z,- 0.01)
    call SetCameraField(CAMERA_FIELD_ZOFFSET,z,0.01)
endfunction

function GetHeroZ takes nothing returns real
    call MoveLocation(udg_CameraPoint, GetUnitX(udg_CameraHero), GetUnitY(udg_CameraHero))
    return GetLocationZ(udg_CameraPoint)
endfunction
It seems to fix the issue of the camera sinking lower when near water.

Also, if you remove GetHeroZ() from the SetCameraZ() Custom script then you can make the Camera stay fixed at the specified height regardless of the Hero's Z height.
  • Custom script: call SetCameraZ(150.00)
 

Attachments

  • Camera Demo.w3m
    18.7 KB · Views: 5
Level 39
Joined
Feb 27, 2007
Messages
5,023
An old Russian modder who was basically of the "I don't care how complicated it is to make it, I will make my own version that does it better [than yours/whatever already exists]" mindset. You'd be like "Yeah you could do that but it would require..." and then 4 replies later TC would show up with a multi-thousand-line library with Russian comments doing exactly what you needed.

TC was cohadar but just not an ass.
 
Status
Not open for further replies.
Top