int PlayerObject::update(long elapsedTime) { if (isKeyDown(IM_W)) walkForward(); if (isKeyDown(IM_S)) walkBackward(); if (isKeyDown(IM_A)) walkLeft(); if (isKeyDown(IM_D)) walkRight(); //if (isKeyPressed(IM_SPACE)) jump(); if (isKeyDown(IM_SPACE)) jump(); if (isKeyPressed(IM_M1)) primaryClick(); if (isKeyReleased(IM_M1)) primaryRelease(); if (isKeyDown(IM_M1)) primaryDown(); if (isKeyUp(IM_M1)) primaryUp(); if (isKeyPressed(IM_M2)) secondaryClick(); if (isKeyReleased(IM_M2)) secondaryRelease(); if (isKeyDown(IM_M2)) secondaryDown(); if (isKeyUp(IM_M2)) secondaryUp(); if (isKeyPressed(IM_1)) changeSpell(0); if (isKeyPressed(IM_2)) changeSpell(1); if (isKeyPressed(IM_3)) changeSpell(2); if (isKeyPressed(IM_4)) changeSpell(3); if (isKeyPressed(IM_5)) changeSpell(4); if (getNetworkState() == NETWORK_STATE_OFFLINE) { if (isMouseScrollUp()) { PropObject * temp = new PropObject("sword.obj", "error.tga", "default.glsl", camera->getPos() + camera->getLookAtVector(), camera->getLookAtVector(), camera->getUpVector(), "sword.prop"); //RagdollObject * temp = new RagdollObject(box, t, s, camera->getPos(), camera->getLookAtVector(), camera->getUpVector()); temp->setVelocity(camera->getLookAtVector()*10.0f); temp->setRotation(camera->getLookAtVector(), camera->getUpVector()); } if (isMouseScrollDown()) { PropObject * temp = new PropObject("box.obj", "error.tga", "default.glsl", camera->getPos() + camera->getLookAtVector(), camera->getLookAtVector(), camera->getUpVector(), "box1x1.prop"); //RagdollObject * temp = new RagdollObject(box, t, s, camera->getPos(), camera->getLookAtVector(), camera->getUpVector()); temp->setVelocity(camera->getLookAtVector()*10.0f); temp->setRotation(camera->getLookAtVector(), camera->getUpVector()); } } POINT p = inputManager->getMouseMovement(); turn(p.x*0.05f, p.y*0.05f); int ret = CharacterObject::update(elapsedTime); //setDirection(camera->getLookAtVector()); camera->setPosition(btToGLM3(&getBTPosition()) + glm::vec3(0,1,0)); camera->setLookAtVector(getDirection()); //camera->update(elapsedTime); return ret; }
void Limb::walk(directions directn, sides side) { switch(directn) { case FORWARD: walkForward(side); break; case BACKWARD: walkBackward(side); break; default: FORWARD; } }
void demoCommandCallback(const std_msgs::String::ConstPtr& msg) { ROS_INFO_STREAM("[Demo] : receive [" << msg->data << "] msg " ); if(msg->data == "ini_pose") { ROS_INFO("demo 1: go to initial pose"); moveToInitPose(); is_init_pose = true; ROS_INFO("[Demo] : please wait 5 seconds"); } else if ( msg->data == "set_mode") { ROS_INFO("demo 2: set walking control mode"); setCtrlModule(); } else if( msg->data == "forward" ) { ROS_INFO("demo 4: forward walking"); walkForward(); } else if( msg->data == "backward" ) { ROS_INFO("demo 5: backward walking"); walkBackward(); } else if( msg->data == "balance_on" ) { ROS_INFO("demo 3: balance enable"); setBalanceOn(); } else if( msg->data == "balance_off" ) { ROS_INFO("demo 3: balance disable"); setBalanceOff(); } else { ROS_ERROR("Invalid Command!!!"); } }