Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Thu May 23, 2013 4:56 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: thirdperson camera doesn't follow jumping up
PostPosted: Thu May 28, 2009 8:43 am 
Offline
fired 300 rounds
User avatar

Joined: Sun Aug 08, 2004 10:59 pm
Posts: 326
Location: PA-USA
Was wondering if there is a way to stop the thirdperson camera from moving upwards while the player is jumping. It can still move in any other direction, just not vertically.

_________________
HardQore 2:
http://www.hq.atomicarmadillo.com
Ruiner:
http://www.ruiner.atomicarmadillo.com


Top
 Profile  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Thu May 28, 2009 4:17 pm 
Offline
Addict.
User avatar

Joined: Tue Nov 22, 2005 1:42 am
Posts: 2165
Location: France, 59
the easiest way should be to "lock" the Z value to a fixed value when updating the cameraposition in the SDK, with something like:
cameraPosition idVec3( playerPosition.x, playerPosition.y, spawnArg origin.z ) <- not a "real" code...

:)

_________________
idTech 4 still amaze me.

Doom III High Quality Mainmenu Pack.
Doom III Boss Contest: Alpha Lab Zero.
idTech4 Extended [Alpha].


Top
 Profile E-mail  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Thu May 28, 2009 9:31 pm 
Offline
picked up a pistol

Joined: Sun Dec 07, 2008 7:35 am
Posts: 51
Location: FL
6th Venom wrote:
the easiest way should be to "lock" the Z value to a fixed value [...]


Wouldn't this cause bad side effects? Unless your map is completely flat and has no vertical differences through out the entire map.
As if you went down stairs or a ramp, your camera would stay on the same Z value, so your camera would not stay behind the player.
Image


Also, do you mind me asking why you would not want the camera to fallow while jumping?


Top
 Profile E-mail  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Thu May 28, 2009 9:45 pm 
Offline
Addict.
User avatar

Joined: Tue Nov 22, 2005 1:42 am
Posts: 2165
Location: France, 59
I suppose it's for Q4: HardQore2 wich is a side scrolling view type (ala mario, contra, etc).

Another possibility should be to trace from the player's origin to down with every clip&solid surfaces, and use the trace.position as a camera position.
Smoothing between old camera position & new camera postion should prevent brutal camera position changes.

_________________
idTech 4 still amaze me.

Doom III High Quality Mainmenu Pack.
Doom III Boss Contest: Alpha Lab Zero.
idTech4 Extended [Alpha].


Top
 Profile E-mail  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Mon Jun 01, 2009 3:23 am 
Offline
picked up a pistol

Joined: Sun Dec 07, 2008 7:35 am
Posts: 51
Location: FL
Why are we getting all these bots all of a sudden?


Top
 Profile E-mail  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Sun Jun 07, 2009 4:54 am 
Offline
fired 300 rounds
User avatar

Joined: Sun Aug 08, 2004 10:59 pm
Posts: 326
Location: PA-USA
its for HardQore 2, which we are doing it on doom 3 this time.

The camera lock would be very helpful in making the game feel more like a side scroller because in almost all of them, the camera doesn't move when you jump. It would also help mapping wise because the mapper would have more control on what to make or not to make in a level.

My hope is to be able to control the camera movement both vertically and horizontal via CVARS which the mapper would trigger. This was done in games like contra, mega man, and metroid. Some areas didn't move up and down, others went only vertically, and lastly some parts of maps didn't move at all (boss rooms).

I'm no coder, that is why i'm asking too. :P

_________________
HardQore 2:
http://www.hq.atomicarmadillo.com
Ruiner:
http://www.ruiner.atomicarmadillo.com


Top
 Profile  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Sun Jun 07, 2009 7:37 pm 
Offline
Addict.
User avatar

Joined: Tue Nov 22, 2005 1:42 am
Posts: 2165
Location: France, 59
Create 2 new Cvars for vertical & horizontal locks and just make something like: (pseudo code)
Code:
cameraPosition = idVec3( ( playerPosition.x * g_lockHorizontalView.getIntegrer() + offsetX ) , playerPosition.y, ( playerPosition.z * g_lockVerticalView.getIntegrer() + offsetZ ) );
...where playerPosition is the actual player position, g_lockHorizontalView & g_lockVerticalView are set to 1 to be enabled or to 0 to be locked, and offsetX & offsetZ are camera offsets if the view is locked (to be able to choose where the camera scroll).

_________________
idTech 4 still amaze me.

Doom III High Quality Mainmenu Pack.
Doom III Boss Contest: Alpha Lab Zero.
idTech4 Extended [Alpha].


Top
 Profile E-mail  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Wed Jun 17, 2009 7:46 am 
Offline
fired 300 rounds
User avatar

Joined: Sun Aug 08, 2004 10:59 pm
Posts: 326
Location: PA-USA
I tried to disable moving the camera in hopes of finding out what is making it track the player.
I've traced it all back to idPlayer::GetEyePosition in the player.cpp file
Here is the little bit of code from it:
Quote:
idVec3 idPlayer::GetEyePosition( void ) const {
idVec3 org;

// use the smoothed origin if spectating another player in multiplayer
if ( gameLocal.isClient && entityNumber != gameLocal.localClientNum ) {
org = smoothedOrigin;
} else {
org = GetPhysics()->GetOrigin();
}
return org + ( GetPhysics()->GetGravityNormal() * -eyeOffset.z );
}

if you comment out the following line, it won't follow the player anymore.
Quote:
org = GetPhysics()->GetOrigin();

Could that line be modified to stop it from going in certain directions?

_________________
HardQore 2:
http://www.hq.atomicarmadillo.com
Ruiner:
http://www.ruiner.atomicarmadillo.com


Top
 Profile  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Wed Jun 17, 2009 10:38 am 
Offline
Addict.
User avatar

Joined: Tue Nov 22, 2005 1:42 am
Posts: 2165
Location: France, 59
revility wrote:
Could that line be modified to stop it from going in certain directions?

Code:
} else {
org = GetPhysics()->GetOrigin();
org.z = 0.0f; // force the Z position to zero
}
:wink:

_________________
idTech 4 still amaze me.

Doom III High Quality Mainmenu Pack.
Doom III Boss Contest: Alpha Lab Zero.
idTech4 Extended [Alpha].


Top
 Profile E-mail  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Wed Jun 17, 2009 5:59 pm 
Offline
fired 300 rounds
User avatar

Joined: Sun Aug 08, 2004 10:59 pm
Posts: 326
Location: PA-USA
that worked :D
Now i just need to wrap the cvars around it and its ready to go. :)
That part I know how to do :P
Big Thanks!

_________________
HardQore 2:
http://www.hq.atomicarmadillo.com
Ruiner:
http://www.ruiner.atomicarmadillo.com


Top
 Profile  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Thu Jun 18, 2009 6:56 pm 
Offline
fired 300 rounds
User avatar

Joined: Sun Aug 08, 2004 10:59 pm
Posts: 326
Location: PA-USA
There is an unexpected problem when it is tied to a cvar.

It looks like it is not taking the current origin of the player and setting it to 0 when turned back on. It is using the z origin from the camera spawned.

If you start a level, and then go to an area where the player must go up or down, like an elevator shaft, turn off the cvar, and then head upwards. Once in the new higher or lower area, if the cvar is turned back on, it puts the camera back to its original z level. Its not setting it to 0 based upon the current position when triggered.

This is how the code was set up:

Quote:
idVec3 idPlayer::GetEyePosition( void ) const {
idVec3 org;

// use the smoothed origin if spectating another player in multiplayer
if ( gameLocal.isClient && entityNumber != gameLocal.localClientNum ) {
org = smoothedOrigin;
}
////START 6TH VENOM/REVILITY STOP THE CAMERA FROM MOVING VERTICALLY
//else {
//org = GetPhysics()->GetOrigin();
//}
if ( !pm_thirdPersonUp.GetBool() ) {
org = GetPhysics()->GetOrigin();
org.z = 0.0f; // force the Z position to zero
}
else {
org = GetPhysics()->GetOrigin();
}
////END 6TH VENOM/REVILITY STOP THE CAMERA FROM MOVING VERTICALLY

return org + ( GetPhysics()->GetGravityNormal() * -eyeOffset.z );
}

_________________
HardQore 2:
http://www.hq.atomicarmadillo.com
Ruiner:
http://www.ruiner.atomicarmadillo.com


Top
 Profile  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Thu Jun 18, 2009 8:44 pm 
Offline
Addict.
User avatar

Joined: Tue Nov 22, 2005 1:42 am
Posts: 2165
Location: France, 59
Create a new pm_thirdPersonCamHeight float Cvar, and:
Code:
idVec3 idPlayer::GetEyePosition( void ) const {
   idVec3 org;

   // use the smoothed origin if spectating another player in multiplayer
   if ( gameLocal.isClient && entityNumber != gameLocal.localClientNum ) {
      org = smoothedOrigin;
   }

////START  REVILITY STOP THE CAMERA FROM MOVING VERTICALLY   <- no need of "6th venom" here ;)
/*   else {
      org = GetPhysics()->GetOrigin();
   }*/      

   else {
      org = GetPhysics()->GetOrigin();

      // if camera can go up/down, update thirdperson camera height
      if ( pm_thirdPersonUp.GetBool() ) {
         pm_thirdPersonCamHeight.SetFloat( org.z );
      }

      // force the Z position to thirdperson camera height
      org.z =  pm_thirdPersonCamHeight.GetFloat();
   }

////END  REVILITY STOP THE CAMERA FROM MOVING VERTICALLY   
   
   return org + ( GetPhysics()->GetGravityNormal() * -eyeOffset.z );
}

This should work. :P

_________________
idTech 4 still amaze me.

Doom III High Quality Mainmenu Pack.
Doom III Boss Contest: Alpha Lab Zero.
idTech4 Extended [Alpha].


Top
 Profile E-mail  
 
 Post subject: Re: thirdperson camera doesn't follow jumping up
PostPosted: Fri Jun 19, 2009 5:02 am 
Offline
fired 300 rounds
User avatar

Joined: Sun Aug 08, 2004 10:59 pm
Posts: 326
Location: PA-USA
I would have never thought of using another cvar for this.

Tried out the code, compiled it, tested it, and tried to make it break. Everything is working perfectly :D

I think this case is finally closed. Big thanks man! Between your main menu and this, the game is feeling more polished :D

Should have the new HQ2 website up within the month with plenty info about the mod... both the game and mapping for it.

_________________
HardQore 2:
http://www.hq.atomicarmadillo.com
Ruiner:
http://www.ruiner.atomicarmadillo.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group