• 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.

Set Camera Height

Status
Not open for further replies.
Level 9
Joined
Aug 7, 2009
Messages
380
Sup again,
I wondered why i just come up with interests with First Person Camera system or so...
and i took a look around HIVE. Oh MY! I screamed up happily when saw this thread: Link
Then i spent my whole evening and come up with a :vw_sad: face when know that the camera height doesn't get the update (when moving on cliffs, elevator... or so... ) Wondering if someone here can do this ***** part
Rep is guaranteed. Credits if wanted :p
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
If it's in GUI, then why not use the Object Manager to see if the function: Camera - Set Camera Field (Timed) is being used in any trigger?

If it is, removing/changing the distance to target or height offset of the camera will be no big deal now would it?
 
Level 9
Joined
Aug 7, 2009
Messages
380
So how about in jass. For details, i'm changed and trying to add this.
Since this system does have some more advances that i might needs and i think it's better
I tried to change values of variables in the "SETUP PART" of the trigger "Cam System" to this:
JASS:
    globals
        // The max. distance the camera can have to the target
        private real DEFAULT_MAX_DISTANCE = 0
    
        // The max. distance the zOffset behind the unit is checked (for zAngle)
        private real DEFAULT_MAX_Z_CHECK_DISTANCE = 2
    
        // the camera angle of attack correction after the zAngle calculation
        private real DEFAULT_ANGLE_OF_ATTACK = 352
    
        // the timer interval (0.01 is best but can lagg in huge maps with many of these short intervals)
        private constant real INTERVAL = 0.03
    
        // the time the camera will need to adjust
        private constant real DELAY = 0.25
    
        // the standart z of the camera
        private constant real NORMAL_HEIGHT = 80
    
        // the accuracy increases if the value gets smaller
        private constant real ACCURACY = 1
    
        // the secondary accruracy when the camera reaches a barricade (just leave at this amount)
        private constant real EXTREME_ACCURACY = 10
    endglobals
Now, the camera goes inside the unit's chest and see the things inside :vw_unimpressed: Can anyone show me up how to make this into the First Person Camera System please :ogre_haosis:
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
How about changing the values to something like:

DEFAULT_MAX_DISTANCE = 50
DEFAULT_MAX_Z_CHECK_DISTANCE = 50
DEFAULT_ANGLE_OF_ATTACK = -8
INTERVAL = 0.01
DELAY = 0.01
NORMAL_HEIGHT = 100
ACCURACY = 5
EXTREME_ACCURACY = 10


(I took these settings from a game currently under development which also uses a first person camera system and which works pretty damn smooth IMO)

However I did alter a small part inside that code to make it work even smoother ;)

This part to be exact:
JASS:
if GetLocalPlayer() == Player(i) then
    call CameraSetSmoothingFactor(1)
    call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, DistanceDone, DELAY)
    call SetCameraField(CAMERA_FIELD_ANGLE_OF_ATTACK, z, DELAY)
    call SetCameraField(CAMERA_FIELD_ZOFFSET,GetCameraField(CAMERA_FIELD_ZOFFSET)+x+GetUnitFlyHeight(CamUnit[i])+NORMAL_HEIGHT-GetCameraTargetPositionZ(),DELAY)
    call SetCameraField(CAMERA_FIELD_ROTATION, angle*bj_RADTODEG+180, 0.45)
    call SetCameraTargetController(CamUnit[i],0,0,false)
endif

Look through the Jass script untill you find that part and copy and paste this over the original.
Test your map and tell me how it looks.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Change the values of these variables to your likings for your specific unit:

//The maximum *Distance to target* the camera can have for your unit
DEFAULT_MAX_DISTANCE

//The standard *Height Offset* of the camera
NORMAL_HEIGHT

Play around with the GUI function: Camera - Set Camera Field (Timed) to see what these fields are and how they will change your camera view if you are unsure.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Perhaps you should take a look at how camera's work.

http://world-editor-tutorials.thehelper.net/cameras.php

Look at the Camera Fields chapter and see their description.

For your question:

Distance:
The distance between the camera and the camera target.

DEFAULT_MAX_DISTANCE is basically the maximum distance the camera can have to the camera target.
(This is not the actual distance between the camera and the target, but this is the MAXIMUM distance that it can have)

If a camera has some unit as target, then changing the distance to target means the camera is further away or closer to the unit.


Try altering

NORMAL_HEIGHT
the actual height offset of the camera from the ground
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
My question to you: if there is a first person camera, why not use no model at all for the unit?
Model File: none.mdl
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
It's most certainly not impossible, all you'd have to do is make a small adjustment so that the camera is not "viewing from inside" your model.
I on the otherhand wouldn't know how big your model is, from which position your camera is viewing or what is being displayed.
Perhaps a screenshot can tell me more?

Also, if the unit's model is too big and you want to see the actual gun of the unit, it's going to be a big mess getting it to work properly...
Perhaps changing the scaling value of your unit's model will solve your issue.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
So what you means is change the value with hundreds of tests to find out the value that fits? OMG. I'm now half the way if i'm not wrong since i really think i tested it for 50 times already - LOL :p

Not exactly...
Let's say your model is quite big both in width and in height. (Remember that you are only changing the height offset of the camera atm!)
This means that in order to make the camera see the actual gun of the unit it should be positioned right above the arms of the unit.
However this would be in the belly of the unit.
If the unit's model is big, it might be that the camera is actually inside the model of the unit. Since the belly can be bigger in width then the camera...
This same thing can count for the head of the unit.
Changing the scaling value of the unit is a solution or if you want to do it professionally, create both an x, y and z offset on your camera so that is is positioned EXACTLY above and on top of the gun of the unit.
This means that you'll have to do quite some tweaking in order to make it look right...

There is also another solution to this problem but it's way more advanced and will cost an extreme amount of work.
Take a look at my posts in this thread if you're interested:
http://www.hiveworkshop.com/forums/...ut-horror-project-dualism-212702/index29.html

Or you could remove the model of the unit and put a model of a gun right underneath the camera.
You can make the gun shoot for you whenever the unit attacks through GUI or Jass.


I just gave you multiple viable solutions. Pick one ;)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Any time :goblin_good_job:

You can also contact me with different issues through PM, I usually have a solution for them.
However I'm not always active on this forum. I've got quite a lot of stuff to work on.
 
Status
Not open for further replies.
Top