little fixes

This commit is contained in:
Anselme 2016-12-14 11:42:05 +01:00
parent 2a32596873
commit 673fa408f2
4 changed files with 5 additions and 9 deletions

View File

@ -60,9 +60,6 @@ PlayerCharacterNode::PlayerCharacterNode(bool noClip) :
m_noclipMode(noClip),
m_inputActions({NO_ACTION, NO_ACTION, NO_ACTION, NO_ACTION, NO_ACTION})
{
m_motionState = new btDefaultMotionState();
// Create the shape
btCollisionShape *shape = new btCapsuleShape(PLAYER_RADIUS, PLAYER_HEIGHT);
@ -71,7 +68,7 @@ PlayerCharacterNode::PlayerCharacterNode(bool noClip) :
shape->calculateLocalInertia(1.0, localInertia);
// Create the rigid body object
m_rigidBody = new btRigidBody(1.0, m_motionState, shape, localInertia);
m_rigidBody = new btRigidBody(1.0, nullptr, shape, localInertia);
// capsule always pointing up
m_rigidBody->setSleepingThresholds(0.0, 0.0);

View File

@ -34,7 +34,6 @@ public:
class PlayerCharacterNode : public CameraNode
{
btRigidBody* m_rigidBody;
btDefaultMotionState *m_motionState;
FirstPersonCamera m_fpsCamera;
bool m_noclipMode;

View File

@ -151,11 +151,11 @@ int main(){
scene.setMainCamera(trackBallCam);
*/
// first person player controller
PlayerCharacterNode *player = new PlayerCharacterNode();
PlayerCharacterNode *player = new PlayerCharacterNode(false);
player->setInputs(myKeysMap::MOVE_FORWARD, myKeysMap::MOVE_BACKWARD, myKeysMap::STRAFE_LEFT, myKeysMap::STRAFE_RIGHT, myKeysMap::TOGGLE_NOCLIP);
scene->getRootObject()->addChild(player);
scene->setMainCamera(player);
player->setPosition(0.f, 10.f, 0.f);
player->setPosition(0.f, 15.f, 0.f);
engine.getPhysics()->addRigidBody(player->getRigidbody());
// throw cubes and spheres with mouse clicks
@ -169,7 +169,7 @@ int main(){
scene->getRootObject()->addChild(sunLight);
// terrain
// generateTerrain(scene, engine.getPhysics());
//generateTerrain(scene, engine.getPhysics());
// shell output tests
engine.outputShell("Hello World!");

View File

@ -118,8 +118,8 @@ void Potator::throwSphere()
glm::vec3 dir(0, 1, 0);
if(m_player != nullptr)
{
pos = m_player->getEyePosition();
dir = m_player->getDirection();
pos = m_player->getEyePosition() + dir*2.f;
}
float throwForce = 20.f;