7#include "CustomPlayerControllerManager.h"
71 Ogre::Real PlayerController::getPlayerHeight() const
73 Ogre::Real height = 0.0f;
74 CustomPlayerController* joint = (CustomPlayerController*) m_joint;
76 height = joint->GetPlayerHeight();
82 void PlayerController::showDebugData(Ogre::SceneNode* debugRootNode)
84 Body* playerBody = getBody0();
85 CustomPlayerController* joint = (CustomPlayerController*) m_joint;
88 Ogre::Quaternion orient;
90 // playerBody->getPositionOrientation(pos, orient);
91 playerBody->getVisualPositionOrientation (pos, orient);
92 dMatrix matrix (dQuaternion (orient.w, orient.x, orient.y, orient.z), dVector (pos.x, pos.y, pos.z, 1.0f));
94 if (!m_debugInfo.size()) {
96 std::ostringstream oss;
98 Ogre::Quaternion orient;
100 OgreNewt::Debugger& debug(playerBody->getWorld()->getDebugger());
102 oss << "__OgreNewt__Debugger__Lines__" << joint->GetSensorShape() << "__";
103 newInfo.m_visualDebug = new Ogre::ManualObject(oss.str());
104 newInfo.m_node = debugRootNode->createChildSceneNode();
105 newInfo.m_playershape = (void*) joint->GetSensorShape();
107 OgreNewt::Collision sensorCollision (joint->GetSensorShape(), playerBody->getWorld());
108 debug.buildDebugObjectFromCollision(newInfo.m_visualDebug, Ogre::ColourValue(1, 0, 0, 1), sensorCollision);
110 newInfo.m_node->attachObject(newInfo.m_visualDebug);
112 // append this debug info to the array
113 m_debugInfo.push_back(newInfo);
116 oss << "__OgreNewt__Debugger__Lines__" << joint->GetStairStepShape() << "__";
117 newInfo.m_visualDebug = new Ogre::ManualObject(oss.str());
118 newInfo.m_node = debugRootNode->createChildSceneNode();
119 newInfo.m_playershape = (void*) joint->GetSensorShape();
121 OgreNewt::Collision stairCollision (joint->GetStairStepShape(), playerBody->getWorld());
122 debug.buildDebugObjectFromCollision(newInfo.m_visualDebug, Ogre::ColourValue(1, 1, 0, 1), stairCollision);
124 newInfo.m_node->attachObject(newInfo.m_visualDebug);
126 // append this debug info to the array
127 m_debugInfo.push_back(newInfo);
131 DebugInfo& shapeInfo = m_debugInfo[0];
132 shapeInfo.m_node->setPosition(pos);
133 shapeInfo.m_node->setOrientation (orient);
134 if (!shapeInfo.m_node->getParent()) {
135 debugRootNode->addChild(shapeInfo.m_node);
138 pos.y += joint->GetPlayerStairHeight();
139 DebugInfo& stairInfo = m_debugInfo[1];
140 stairInfo.m_node->setPosition(pos);
141 stairInfo.m_node->setOrientation (orient);
142 if (!stairInfo.m_node->getParent()) {
143 debugRootNode->addChild(stairInfo.m_node);
147} // end NAMESPACE OgreNewt