Somehwat improved kart and wheel location, so that skid marks appear

'more' under the wheels. At this stage kart will partially go 'into'
the track when turning though :(  WIP, just to get some feedback, 
this patch need to cleaned up!


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14390 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2013-11-06 00:03:10 +00:00
parent b4c698760a
commit 04d0859f9d
3 changed files with 18 additions and 13 deletions

View File

@ -1330,6 +1330,7 @@ void Kart::update(float dt)
m_shadow->enableShadow();
m_shadow_enabled = true;
}
//m_shadow->disableShadow();
} // update
//-----------------------------------------------------------------------------
@ -2397,13 +2398,11 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
}
m_kart_model->update(dt, m_wheel_rotation_dt, getSteerPercent(), wheel_up_axis, m_speed);
Vec3 center_shift = m_kart_properties->getGravityCenterShift();
float y = m_vehicle->getWheelInfo(0).m_chassisConnectionPointCS.getY()
- m_default_suspension_length[0]
Vec3 center_shift = m_kart_properties->getGravityCenterShift();
float y = m_kart_model->getWheelGraphicsRadius(0)
- m_vehicle->getWheelInfo(0).m_wheelsRadius
- (m_kart_model->getWheelGraphicsRadius(0)
-m_kart_model->getWheelGraphicsPosition(0).getY() );
y += m_skidding->getGraphicalJumpOffset();
+ m_skidding->getGraphicalJumpOffset();
center_shift.setY(y);
if ((m_controls.m_nitro || m_min_nitro_time > 0.0f) && isOnGround() && m_collected_energy > 0)

View File

@ -779,7 +779,7 @@ void KartModel::update(float dt, float rotation_dt, float steer, const float sus
}
#endif
core::vector3df pos = m_wheel_graphics_position[i].toIrrVector();
pos.Y += clamped_suspension[i];
pos.Y += suspension[i];
m_wheel_node[i]->setPosition(pos);
// Now calculate the new rotation: (old + change) mod 360

View File

@ -323,9 +323,10 @@ btScalar btKart::rayCast(unsigned int index)
#else
if(index==2 || index==3)
{
if(m_visual_rotation==0)
if(m_visual_rotation==0.123123123)
{
m_visual_contact_point[index] = rayResults.m_hitPointInWorld;
m_visual_contact_point[index ] = rayResults.m_hitPointInWorld;
m_visual_contact_point[index-2] = source;
m_visual_wheels_touch_ground &= (object!=NULL);
}
else
@ -335,19 +336,21 @@ btScalar btKart::rayCast(unsigned int index)
{
getRigidBody()->getMotionState()->getWorldTransform(chassisTrans);
}
btQuaternion q(Vec3(0,1,0), m_visual_rotation);
btQuaternion q(m_visual_rotation, 0, 0);
btQuaternion rot_new = chassisTrans.getRotation() * q;
chassisTrans.setRotation(rot_new);
btVector3 pos = wheel.m_chassisConnectionPointCS;
pos.setZ(pos.getZ() * 0.3f);
btVector3 pos = m_kart->getKartModel()->getWheelGraphicsPosition(index);
pos.setZ(pos.getZ()*0.9f);
//pos.setX(pos.getX()*0.1f);
//btVector3 pos = wheel.m_chassisConnectionPointCS;
btVector3 source = chassisTrans( pos );
btVector3 target = source + rayvector;
btVehicleRaycaster::btVehicleRaycasterResult rayResults;
void* object = m_vehicleRaycaster->castRay(source,target,rayResults);
m_visual_contact_point[index] = rayResults.m_hitPointInWorld;
m_visual_contact_point[index-2] = source;
m_visual_wheels_touch_ground &= (object!=NULL);
}
}
#endif
@ -939,6 +942,9 @@ void btKart::debugDraw(btIDebugDraw* debugDrawer)
wheelColor);
} // for i < getNumWheels
btVector3 yellow(1.0f, 1.0f, 0.0f);
debugDrawer->drawLine(m_visual_contact_point[0], m_visual_contact_point[2], yellow);
debugDrawer->drawLine(m_visual_contact_point[1], m_visual_contact_point[3], yellow);
} // debugDraw