AggrorJorn Posted March 21, 2013 Share Posted March 21, 2013 I am not sure if I am doing something wrong or whether this is a bug. My characters movement seems to work fine at first, but after some walking around, I notice that the strafing no longer works correct. sometimes I go into the opposite direction of where I want to go. The example attached shows that strafe walking doesn't function properly and that jumping has some issues as well. //Get the mouse movement Vec3 currentMousePos = window->GetMousePosition(); mouseDifference.x = currentMousePos.x - centerMouse.x; mouseDifference.y = currentMousePos.y - centerMouse.y; //Adjust and set the camera rotation camRotation.x += mouseDifference.y / mouseSensitivity; camRotation.y += mouseDifference.x / mouseSensitivity; camera->SetRotation(camRotation); window->SetMousePosition(centerMouse.x, centerMouse.y); //Player Movement playerMovement.x = (window->KeyDown(Key:) - window->KeyDown(Key::A)) * Time::GetSpeed() * strafeSpeed; playerMovement.z = (window->KeyDown(Key::W) - window->KeyDown(Key::S)) * Time::GetSpeed() * moveSpeed; //Update the player player->SetInput(camRotation.y, playerMovement.z, playerMovement.x, 0, crouched, 0.5); Vec3 playerPos = player->GetPosition(); camera->SetPosition(playerPos.x, playerPos.y + 1.8, playerPos.z); Jumping also has problems. I have this really simple code that lets the player jump. Unfortunately this only works sporadicly, after hitting the space key a 10 to 20 times. The weird thing is, when you leave out the check for the Space key being pressed, the character jumps perfectly normal (although it keeps jumping ofcourse, since we no longer check for key pressing). // Check for jumping float tempJumpForce = 0; if(window->KeyHit(Key::Space) && player->GetAirborne()) tempJumpForce = 10; //Update the player player->SetInput(0, 0, 0, tempJumpForce , false, 1); Any body else getting these results? Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 21, 2013 Author Share Posted March 21, 2013 When I wanted to record the project to show what is going on, somehow the jumping worked. It turns out that the FPS causes the jumping to either work or not work. After setting the vsync to true (60 fps) jumping works normally. without vsync I have 800 fps. Quote Link to comment Share on other sites More sharing options...
Admin Posted March 21, 2013 Share Posted March 21, 2013 The physics is updated at 60 hz, regardless of framerate. It's really best to call SetInput in the UpdatePhysics callback, because then you can be sure jumps will make it into the next physics update. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 21, 2013 Author Share Posted March 21, 2013 Okay thanks, that solves the jumping problem. Any idea on the strafing? Quote Link to comment Share on other sites More sharing options...
Admin Posted March 21, 2013 Share Posted March 21, 2013 I will test it when we get back. Quote Link to comment Share on other sites More sharing options...
Andy Gilbert Posted March 21, 2013 Share Posted March 21, 2013 The strafe is a known bug, I reported it while back. Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 21, 2013 Author Share Posted March 21, 2013 Thank you Andy. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.