Added new command line option "--camera-wheel-debug" which positions the

camera at wheel level (to better check if wheels are positioned at the right
height).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14392 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-11-06 06:08:31 +00:00
parent 5c5155cce5
commit d7319b766f
3 changed files with 24 additions and 8 deletions

View File

@ -449,8 +449,9 @@ namespace UserConfigParams
/** True if check structures should be debugged. */
PARAM_PREFIX bool m_check_debug PARAM_DEFAULT( false );
/** Special debug camera being high over the kart. */
PARAM_PREFIX bool m_camera_debug PARAM_DEFAULT( false );
/** Special debug camera: 0: normal cameral; 1: being high over the kart.;
2: on ground level. */
PARAM_PREFIX int m_camera_debug PARAM_DEFAULT( false );
/** True if physics debugging should be enabled. */
PARAM_PREFIX bool m_physics_debug PARAM_DEFAULT( false );

View File

@ -35,6 +35,7 @@
#include "karts/kart_properties.hpp"
#include "karts/skidding.hpp"
#include "modes/world.hpp"
#include "physics/btKart.hpp"
#include "race/race_manager.hpp"
#include "tracks/track.hpp"
#include "utils/aligned_array.hpp"
@ -387,13 +388,21 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
// Fall through to falling mode.
case CM_FALLING:
{
*above_kart = 0.75f;
if(UserConfigParams::m_camera_debug==2)
{
*above_kart = 0;
*cam_angle = 0;
}
else
{
*above_kart = 0.75f;
*cam_angle = kp->getCameraForwardUpAngle();
}
float steering = m_kart->getSteerPercent()
* (1.0f + (m_kart->getSkidding()->getSkidFactor()
- 1.0f)/2.3f );
// quadratically to dampen small variations (but keep sign)
float dampened_steer = fabsf(steering) * steering;
*cam_angle = kp->getCameraForwardUpAngle();
*sideway = -m_rotation_range*dampened_steer*0.5f;
*distance = -m_distance;
*smoothing = true;
@ -447,7 +456,7 @@ void Camera::update(float dt)
// The following settings give a debug camera which shows the track from
// high above the kart straight down.
if (UserConfigParams::m_camera_debug)
if (UserConfigParams::m_camera_debug==1)
{
core::vector3df xyz = m_kart->getXYZ().toIrrVector();
m_camera->setTarget(xyz);
@ -509,9 +518,10 @@ void Camera::positionCamera(float dt, float above_kart, float cam_angle,
{
Vec3 wanted_position;
Vec3 wanted_target = m_kart->getXYZ();
wanted_target.setY(wanted_target.getY()+above_kart);
if(UserConfigParams::m_camera_debug==2)
wanted_target.setY(m_kart->getVehicle()->getWheelInfo(2).m_raycastInfo.m_contactPointWS.getY());
else
wanted_target.setY(wanted_target.getY()+above_kart);
float tan_up = tan(cam_angle);
Vec3 relative_position(side_way,
fabsf(distance)*tan_up+above_kart,

View File

@ -635,6 +635,11 @@ int handleCmdLine(int argc, char **argv)
{
UserConfigParams::m_ftl_debug = true;
}
else if(UserConfigParams::m_artist_debug_mode &&
!strcmp(argv[i], "--camera-wheel-debug"))
{
UserConfigParams::m_camera_debug=2;
}
else if(UserConfigParams::m_artist_debug_mode &&
!strcmp(argv[i], "--camera-debug"))
{