Search the Community
Showing results for tags 'rotation'.
-
Hi. I would like to make the rotation of the gun at -45 and +45 (or less) degrees relative to that of the camera. When I limit the values, it only works according to the world coordinate. For example, when I turn a full turn to the left, I have to turn a full turn right again so that the gun rotates in the right direction. I want to do a gun control like Insurgency game. How can I fix this? Here is my code. float currentTime = Time::GetCurrent(); Vec2 currentMousePos = Window::GetCurrent()->GetMousePosition(); Window::GetCurrent()->SetMousePosition(Math::Round(Context::GetCurrent()->GetWidth() / 2), Math::Round(Context::GetCurrent()->GetHeight() / 2)); Vec2 centerPos = Window::GetCurrent()->GetMousePosition(); currentMousePos.x = Math::Round(currentMousePos.x); currentMousePos.y = Math::Round(currentMousePos.y); mouseDifference.x = Math::Curve(currentMousePos.x - centerPos.x, mouseDifference.x, 2 / Time::GetSpeed()); mouseDifference.y = Math::Curve(currentMousePos.y - centerPos.y, mouseDifference.y, 2 / Time::GetSpeed()); camRotation.x = Math::Clamp(camRotation.x + mouseDifference.y / mouseSensitivity, -90, 90); camRotation.y = camRotation.y + (mouseDifference.x / mouseSensitivity); hurtOffset.x = Math::Inc(0, hurtOffset.x, 2 * Time::GetSpeed()); hurtOffset.y = Math::Inc(0, hurtOffset.y, 2 * Time::GetSpeed()); smoothedHurtOffset.x = Math::Curve(hurtOffset.x, smoothedHurtOffset.x, 3); smoothedHurtOffset.y = Math::Curve(hurtOffset.y, smoothedHurtOffset.y, 3); bobOffset.x = Math::Inc(0, bobOffset.x, Time::GetSpeed() * 0.8f); bobOffset.y = Math::Inc(0, bobOffset.y, Time::GetSpeed()); smoothedBobOffset.x = Math::Curve(bobOffset.x, smoothedBobOffset.x, 25); smoothedBobOffset.y = Math::Curve(bobOffset.y, smoothedBobOffset.y, 25); weaponViewRot.x = Math::Clamp(camRotation.x + mouseDifference.y / mouseSensitivity, -45, 45); weaponViewRot.y = Math::Clamp(camRotation.y + mouseDifference.x / mouseSensitivity, -45, 45); smoothWeaponViewRot.x = Math::Curve(weaponViewRot.x, smoothedHurtOffset.x, 5); smoothWeaponViewRot.y = Math::Curve(weaponViewRot.y, smoothedHurtOffset.x, 5); playerCamera->SetRotation(camRotation + smoothedBobOffset + smoothedHurtOffset); testWeapon->entity->SetRotation(camRotation + smoothWeaponViewRot); if (Window::GetCurrent()->MouseDown(1)) { testWeapon->weaponShoot(); }
-
Is there a way to rotate camera around the selection (selected object) in the editor? To observe selection from different directions. (I found only the free rotation mode (with right mouse button) which rotates camera around it`s own pivot)
-
The picture shows how I set up my turret. http://pastebin.com/vDrh15pd This is the script I attached to the turret. When I am ingame the bullet is still rotated 0,0,0 and only after some time it follows the turret. The turret is looking at the target, which is the enemy. When the turret calls the Shoot() function the bullet flies somewhere but the -z axis on the local (space?). It seems like the muttle pivot is no real child of the turret.
-
1. I have been searching in the Internet and found a Rover model: http://opengameart.org/content/mars-rover When I open it up in Blender, it says the rotation is 000, as well as the location. But when I import it inside Leadwerks, it says that the rotation is 90,0,0 (it is rotated right, but it should be 0,0,0). That is why there are some problems with the car script. 2 The car script does not work on the rover, even if all physics are adjusted as same as the prefab car, the rover tires have some weird position and only the starting sound appears to work. 3. So now I taught I will make it like this : SetParent the rover to the car and put an invisible material on the car(also scale it so it handles more realistic). This has workend in parts, when I have no physics on the rover. Now the problem is , when I make this the rotation is 0,0,0 and not 90,0,0 ,so the rover is not rotated correct. http://steamcommunity.com/sharedfiles/filedetails/?id=345315752&searchtext=car Also something else, that is probably caused by the settings file: I cannot select a box (or else shape) for the physics inside the editor. I only see the following: physics mode, collision type, Mass, character angle, swept collision, nav obstacle.