The 'feature' that objects below -100 are automatically reset
to their initial position (which was used to reset stones falling down a volcano) must now be explicitely requested (reset-when-below). This fixes the prpblem of floating barrels in sandtrack. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12461 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
9a4d6f1cda
commit
21063342a1
@ -40,13 +40,15 @@ using namespace irr;
|
||||
PhysicalObject::PhysicalObject(const XMLNode &xml_node)
|
||||
: TrackObject(xml_node)
|
||||
{
|
||||
m_shape = NULL;
|
||||
m_body = NULL;
|
||||
m_motion_state = NULL;
|
||||
m_mass = 1;
|
||||
m_radius = -1;
|
||||
m_crash_reset = false;
|
||||
m_explode_kart = false;
|
||||
m_shape = NULL;
|
||||
m_body = NULL;
|
||||
m_motion_state = NULL;
|
||||
m_reset_when_too_low = false;
|
||||
m_reset_height = 0;
|
||||
m_mass = 1;
|
||||
m_radius = -1;
|
||||
m_crash_reset = false;
|
||||
m_explode_kart = false;
|
||||
|
||||
std::string shape;
|
||||
xml_node.get("mass", &m_mass );
|
||||
@ -54,6 +56,8 @@ PhysicalObject::PhysicalObject(const XMLNode &xml_node)
|
||||
xml_node.get("shape", &shape );
|
||||
xml_node.get("reset", &m_crash_reset);
|
||||
xml_node.get("explode", &m_explode_kart);
|
||||
m_reset_when_too_low =
|
||||
xml_node.get("reset-when-below", &m_reset_height) == 1;
|
||||
|
||||
m_body_type = MP_NONE;
|
||||
if (shape=="cone" ||
|
||||
@ -263,7 +267,7 @@ void PhysicalObject::update(float dt)
|
||||
m_motion_state->getWorldTransform(t);
|
||||
|
||||
Vec3 xyz = t.getOrigin();
|
||||
if(xyz.getY()<-100)
|
||||
if(m_reset_when_too_low && xyz.getY()<m_reset_height)
|
||||
{
|
||||
m_body->setCenterOfMassTransform(m_init_pos);
|
||||
m_body->setLinearVelocity (btVector3(0,0,0));
|
||||
|
@ -83,6 +83,13 @@ private:
|
||||
/** True if kart should "explode" when touching this */
|
||||
bool m_explode_kart;
|
||||
|
||||
/** True if object should be reset to its initial position if it's
|
||||
* too low (see m_reset_height). */
|
||||
bool m_reset_when_too_low;
|
||||
|
||||
/** If m_reset_when_too_low this object is set back to its start
|
||||
* position if its height is below this value. */
|
||||
float m_reset_height;
|
||||
public:
|
||||
PhysicalObject (const XMLNode &node);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user