Added separate roll computation, which fixes issues with
the upright constraint, and might also fix steering issues on slopes. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5031 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
9862807c5e
commit
2a671b0e77
@ -42,10 +42,10 @@ float KartProperties::UNDEFINED = -99.9f;
|
||||
*/
|
||||
KartProperties::KartProperties(const std::string &filename) : m_icon_material(0)
|
||||
{
|
||||
m_name = "Tux";
|
||||
m_ident = "tux";
|
||||
m_icon_file = "tuxicon.png";
|
||||
m_shadow_file = "generickartshadow.png";
|
||||
m_name = "NONAME";
|
||||
m_ident = "NONAME";
|
||||
m_icon_file = "";
|
||||
m_shadow_file = "";
|
||||
|
||||
m_groups.clear();
|
||||
m_custom_sfx_id.resize(SFXManager::NUM_CUSTOMS);
|
||||
|
@ -106,6 +106,7 @@ void Moveable::update(float dt)
|
||||
// y to positive values, i.e. no pitch of more than pi/2.
|
||||
Vec3 up = getTrans().getBasis().getColumn(1);
|
||||
m_pitch = atan2(up.getZ(), fabsf(up.getY()));
|
||||
m_roll = atan2(up.getX(), up.getY());
|
||||
|
||||
updateGraphics(Vec3(0,0,0), btQuaternion(0, 0, 0, 1));
|
||||
m_first_time = false ;
|
||||
|
@ -48,6 +48,8 @@ private:
|
||||
float m_heading;
|
||||
/** The pitch between -90 and 90 degrees. */
|
||||
float m_pitch;
|
||||
/** The roll between -180 and 180 degrees. */
|
||||
float m_roll;
|
||||
|
||||
protected:
|
||||
UserPointer m_user_pointer;
|
||||
@ -79,6 +81,9 @@ public:
|
||||
/** Returns the pitch of the kart, restricted to between -90 and 90 degrees.
|
||||
* Note that using getHPR().getPitch can result in a different value! */
|
||||
float getPitch() const {return m_pitch; }
|
||||
/** Returns the roll of the kart between -180 and 180 degrees. Note that
|
||||
* using getHPR.getRoll can result in a different value! */
|
||||
float getRoll() const {return m_roll; }
|
||||
const btQuaternion
|
||||
getRotation() const {return m_transform.getRotation(); }
|
||||
|
||||
|
@ -120,8 +120,7 @@ void btUprightConstraint::buildJacobian()
|
||||
btTransform worldTransform = m_rbA.getCenterOfMassTransform() * m_frameInA;
|
||||
btVector3 upAxis = worldTransform.getBasis().getColumn(2);
|
||||
m_limit[ 0 ].m_angle = m_kart->getPitch();
|
||||
m_limit[ 1 ].m_angle = m_kart->getHPR().getRoll();
|
||||
|
||||
m_limit[ 1 ].m_angle = m_kart->getRoll();
|
||||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
new (&m_jacAng[ i ]) btJacobianEntry( m_limit[ i ].m_axis,
|
||||
|
Loading…
Reference in New Issue
Block a user