Updated animation rotations.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3804 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2009-08-04 13:05:13 +00:00
parent 05567fea39
commit 2acfc48e3e
4 changed files with 30 additions and 19 deletions

View File

@ -22,8 +22,7 @@
#include "io/xml_node.hpp"
const std::string Ipo::m_all_channel_names[IPO_MAX] =
{std::string("LocX"), std::string("LocY"), std::string("LocZ"),
std::string("RotX"), "RotY", "RotZ"};
{"LocX", "LocY", "LocZ", "RotX", "RotY", "RotZ"};
Ipo::Ipo(const XMLNode &curve, float fps)
{
@ -114,12 +113,12 @@ void Ipo::update(float dt, core::vector3df *xyz, core::vector3df *hpr)
switch(m_channel)
{
case Ipo::IPO_LOCX : xyz->X = get(); break;
case Ipo::IPO_LOCY : xyz->Y = get(); break;
case Ipo::IPO_LOCZ : xyz->Z = get(); break;
case Ipo::IPO_ROTX : hpr->X = get(); break;
case Ipo::IPO_ROTY : hpr->Y = get(); break;
case Ipo::IPO_ROTZ : hpr->Z = get(); break;
case Ipo::IPO_LOCX : xyz->X = get(); break;
case Ipo::IPO_LOCY : xyz->Y = get(); break;
case Ipo::IPO_LOCZ : xyz->Z = get(); break;
case Ipo::IPO_ROTX : hpr->X = -get(); break; // the - signs are odd,
case Ipo::IPO_ROTY : hpr->Y = -get(); break; // but it works
case Ipo::IPO_ROTZ : hpr->Z = get(); break; // why no - ??
default: assert(false); // shut up compiler warning
} // switch

View File

@ -82,10 +82,23 @@ void ThreeDAnimation::createPhysicsBody(const std::string &shape)
{
m_collision_shape = new btBoxShape(0.5*extend);
}
else if(shape=="cone")
else if(shape=="coneX")
{
float radius = 0.5f*std::max(extend.getY(), extend.getZ());
m_collision_shape = new btConeShapeX(radius, extend.getX());
}
else if(shape=="coneY")
{
float radius = 0.5f*std::max(extend.getX(), extend.getZ());
m_collision_shape = new btConeShape(radius, extend.getY());
}
else if(shape=="coneZ")
{
// Note that the b3d model and therefore the extend has the
// irrlicht axis, i.e. Y and Z swapped. Also we need to
// convert
float radius = 0.5f*std::max(extend.getX(), extend.getY());
m_collision_shape = new btConeShapeZ(radius, extend.getZ());
m_collision_shape = new btConeShapeZ(radius, extend.getZ());
}
else
{
@ -131,7 +144,7 @@ void ThreeDAnimation::update(float dt)
if(m_body)
{
hpr = DEGREE_TO_RAD*hpr;
btQuaternion q(hpr.X, hpr.Z, -hpr.Y);
btQuaternion q(-hpr.Z, -hpr.X, -hpr.Y);
Vec3 p(xyz);
btTransform trans(q,p);
m_motion_state->setWorldTransform(trans);

View File

@ -100,7 +100,6 @@ InputManager::~InputManager()
void InputManager::handleStaticAction(int key, int value)
{
static bool control_is_pressed=false;
printf("%d %d %d\n",key,value,control_is_pressed);
switch (key)
{
#ifdef DEBUG

View File

@ -529,14 +529,14 @@ void Track::createWater(const XMLNode &node)
//scene::IMesh *mesh = irr_driver->getMesh(full_path);
scene::IAnimatedMesh *mesh = irr_driver->getSceneManager()->getMesh(full_path.c_str());
irr_driver->getSceneManager()->addWaterSurfaceSceneNode(mesh->getMesh(0));
// scene::IAnimatedMesh *mesh = irr_driver->getSceneManager()->addHillPlaneMesh("myHill",
// core::dimension2d<f32>(20,20),
// core::dimension2d<u32>(40,40), 0, 0,
// core::dimension2d<f32>(0,0),
// core::dimension2d<f32>(10,10));
//irr_driver->getSceneManager()->addWaterSurfaceSceneNode(mesh->getMesh(0));
//scene::IAnimatedMesh *mesh = irr_driver->getSceneManager()->addHillPlaneMesh("myHill",
// core::dimension2d<f32>(20,20),
// core::dimension2d<u32>(40,40), 0, 0,
// core::dimension2d<f32>(0,0),
// core::dimension2d<f32>(10,10));
scene::SMeshBuffer b(*(scene::SMeshBuffer*)(mesh->getMesh(0)->getMeshBuffer(0)));
//scene::SMeshBuffer b(*(scene::SMeshBuffer*)(mesh->getMesh(0)->getMeshBuffer(0)));
//scene::SMeshBuffer* buffer = new scene::SMeshBuffer(*(scene::SMeshBuffer*)(mesh->getMeshBuffer(0)));
float wave_height = 2.0f;