Fixed incorrect rotations of bubble gums after a switch (bug 3155867).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7482 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2fd0ee3978
commit
a6b2fe443d
@ -34,7 +34,7 @@ Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal,
|
||||
m_xyz = xyz;
|
||||
m_deactive_time = 0;
|
||||
// Sets heading to 0, and sets pitch and roll depending on the normal. */
|
||||
Vec3 hpr = Vec3(0, normal);
|
||||
m_original_hpr = Vec3(0, normal);
|
||||
m_item_id = item_id;
|
||||
m_original_type = ITEM_NONE;
|
||||
m_collected = false;
|
||||
@ -53,7 +53,7 @@ Item::Item(ItemType type, const Vec3& xyz, const Vec3& normal,
|
||||
World::getWorld()->getTrack()->adjustForFog(m_node);
|
||||
m_node->setAutomaticCulling(scene::EAC_FRUSTUM_BOX);
|
||||
m_node->setPosition(xyz.toIrrVector());
|
||||
m_node->setRotation(hpr.toIrrHPR());
|
||||
m_node->setRotation(m_original_hpr.toIrrHPR());
|
||||
m_node->grab();
|
||||
} // Item
|
||||
|
||||
@ -90,10 +90,11 @@ void Item::switchBack()
|
||||
// bubble gum has no original type.
|
||||
if(m_original_type==ITEM_NONE)
|
||||
return;
|
||||
|
||||
|
||||
setType(m_original_type);
|
||||
m_original_type = ITEM_NONE;
|
||||
m_node->setMesh(m_original_mesh);
|
||||
m_node->setRotation(m_original_hpr.toIrrHPR());
|
||||
} // switchBack
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -64,6 +64,14 @@ private:
|
||||
* It is ITEM_NONE if the item is not switched. */
|
||||
ItemType m_original_type;
|
||||
|
||||
/** Stores the original rotation of an item. This is used in
|
||||
* case of a switch to restore the rotation of a bubble gum
|
||||
* (bubble gums don't rotate, but it will be replaced with
|
||||
* a nitro which rotates, and so overwrites the original
|
||||
* rotation).
|
||||
*/
|
||||
Vec3 m_original_hpr;
|
||||
|
||||
/** True if item was collected & is not displayed. */
|
||||
bool m_collected;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user