public void renderCube() { int w = Gdx.graphics.getBackBufferWidth(); int h = Gdx.graphics.getBackBufferHeight(); int x = (int)(w - w*0.5f); int y = (int)(h - h*0.5f); w *= 0.5f; h *= 0.5f; Gdx.gl.glViewport(x, y, w, h); Gdx.gl.glEnable(GL20.GL_SCISSOR_TEST); Gdx.gl.glScissor(x, y, w, h); Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT); pitch += 25 * Gdx.graphics.getDeltaTime(); yaw += 45 * Gdx.graphics.getDeltaTime(); cubeInstance.transform.setFromEulerAngles(yaw, pitch, roll); cubeBatch.begin(camCube); cubeBatch.render(cubeInstance); cubeBatch.end(); } }
public AnglesToRotationAxis(double pitch, double yaw, double roll) { super(); matrix.setFromEulerAngles((float) yaw, (float) pitch, (float) roll); }
@Override public void update(float deltaTime) { super.update(deltaTime); followTransform.getTranslation(worldPos); camera.view.getRotation(quat).conjugate(); if (faceUp) { modelInstance.transform.setFromEulerAngles(quat.getYaw(), -90, quat.getRoll()); } else { modelInstance.transform.set(quat); } modelInstance.transform.setTranslation(worldPos.add(offset)); } }
/** * Stops steering; this restores normal friction so it cannot slide down most slopes. * Removes any angular velocity the body accumulated. * Sets the body to the orientation of the model. * @param clearLinearVelocity whether linear velocity should be cleared or not */ protected void stopSteering(boolean clearLinearVelocity) { wasSteering = false; body.setFriction(steerSettings.getIdleFriction()); body.setAngularVelocity(Vector3.Zero); // Since we were only rotating the model when steering, set body to // model rotation when finished moving. position = getPosition(); modelTransform.setFromEulerAngles( currentOrientation.getYaw(), currentOrientation.getPitch(), currentOrientation.getRoll()).setTranslation(position); body.setWorldTransform(modelTransform); if (steerer != null) { clearLinearVelocity = steerer.stopSteering(); } steerer = null; steeringOutput.setZero(); if (clearLinearVelocity) { body.setLinearVelocity(Vector3.Zero); } }
modelTransform.setFromEulerAngles( currentOrientation.getYaw(), currentOrientation.getPitch(),