Added --phsyics-debug option, which (atm) will make the graphical
wheels invisible if they don't touch the ground. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/physics@10156 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
ed200a2302
commit
4a5a8edcb7
@ -389,6 +389,9 @@ namespace UserConfigParams
|
||||
/** Special debug camera being high over the kart. */
|
||||
PARAM_PREFIX bool m_camera_debug PARAM_DEFAULT( false );
|
||||
|
||||
/** True if physics debugging should be enabled. */
|
||||
PARAM_PREFIX bool m_physics_debug PARAM_DEFAULT( false );
|
||||
|
||||
/** True if slipstream debugging is activated. */
|
||||
PARAM_PREFIX bool m_slipstream_debug PARAM_DEFAULT( false );
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "graphics/mesh_tools.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
|
||||
#define SKELETON_DEBUG 0
|
||||
@ -508,7 +509,9 @@ void KartModel::update(float rotation, float steer, const float suspension[4])
|
||||
m_max_suspension[i]);
|
||||
float ratio = clamped_suspension[i] / suspension_length;
|
||||
const int sign = ratio < 0 ? -1 : 1;
|
||||
ratio = sign * fabsf(ratio*(2-ratio)); // expanded form of 1 - (1 - x)^2, i.e. making suspension display quadratic and not linear
|
||||
// expanded form of 1 - (1 - x)^2, i.e. making suspension display
|
||||
// quadratic and not linear
|
||||
ratio = sign * fabsf(ratio*(2-ratio));
|
||||
clamped_suspension[i] = ratio*suspension_length;
|
||||
} // for i<4
|
||||
|
||||
@ -519,6 +522,16 @@ void KartModel::update(float rotation, float steer, const float suspension[4])
|
||||
for(unsigned int i=0; i<4; i++)
|
||||
{
|
||||
if(!m_wheel_node[i]) continue;
|
||||
#ifdef DEBUG
|
||||
if(UserConfigParams::m_physics_debug)
|
||||
{
|
||||
// Make wheels that are not touching the ground invisible
|
||||
bool wheel_has_contact =
|
||||
m_kart->getVehicle()->getWheelInfo(i).m_raycastInfo
|
||||
.m_isInContact;
|
||||
m_wheel_node[i]->setVisible(wheel_has_contact);
|
||||
}
|
||||
#endif
|
||||
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
|
||||
pos.Y += clamped_suspension[i];
|
||||
m_wheel_node[i]->setPosition(pos);
|
||||
|
@ -606,6 +606,11 @@ int handleCmdLine(int argc, char **argv)
|
||||
{
|
||||
UserConfigParams::m_camera_debug=1;
|
||||
}
|
||||
else if(UserConfigParams::m_artist_debug_mode &&
|
||||
!strcmp(argv[i], "--physics-debug"))
|
||||
{
|
||||
UserConfigParams::m_physics_debug=1;
|
||||
}
|
||||
else if(!strcmp(argv[i], "--kartsize-debug"))
|
||||
{
|
||||
for(unsigned int i=0;
|
||||
|
Loading…
Reference in New Issue
Block a user