Java Code Examples for com.badlogic.gdx.math.MathUtils#radiansToDegrees()
The following examples show how to use
com.badlogic.gdx.math.MathUtils#radiansToDegrees() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Scene2dFlockingTest.java From gdx-ai with Apache License 2.0 | 5 votes |
@Override public void draw () { if (drawDebug) { Steerable<Vector2> steerable = characters.get(0); shapeRenderer.begin(ShapeType.Line); shapeRenderer.setColor(0, 1, 0, 1); float angle = char0Proximity.getAngle() * MathUtils.radiansToDegrees; shapeRenderer.arc(steerable.getPosition().x, steerable.getPosition().y, char0Proximity.getRadius(), steerable.getOrientation() * MathUtils.radiansToDegrees - angle / 2f + 90f, angle); shapeRenderer.end(); } }
Example 2
Source File: MDQuaternion.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 4 votes |
/** Get the roll euler angle in degrees, which is the rotation around the z axis. Requires that this quaternion is normalized. * @return the rotation around the z axis in degrees (between -180 and +180) */ public float getRoll () { return getRollRad() * MathUtils.radiansToDegrees; }
Example 3
Source File: MDQuaternion.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 4 votes |
/** Get the pitch euler angle in degrees, which is the rotation around the x axis. Requires that this quaternion is normalized. * @return the rotation around the x axis in degrees (between -90 and +90) */ public float getPitch () { return getPitchRad() * MathUtils.radiansToDegrees; }
Example 4
Source File: MDQuaternion.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 4 votes |
/** Get the yaw euler angle in degrees, which is the rotation around the y axis. Requires that this quaternion is normalized. * @return the rotation around the y axis in degrees (between -180 and +180) */ public float getYaw () { return getYawRad() * MathUtils.radiansToDegrees; }
Example 5
Source File: EntityRenderState.java From uracer-kotd with Apache License 2.0 | 4 votes |
/** Transform the world position from meters to pixels. */ public void toPixels () { this.position.x = Convert.mt2px(this.position.x); this.position.y = Convert.mt2px(this.position.y); this.orientation = this.orientation * MathUtils.radiansToDegrees; }
Example 6
Source File: MDQuaternion.java From MD360Player4Android with Apache License 2.0 | 4 votes |
/** Get the roll euler angle in degrees, which is the rotation around the z axis. Requires that this quaternion is normalized. * @return the rotation around the z axis in degrees (between -180 and +180) */ public float getRoll () { return getRollRad() * MathUtils.radiansToDegrees; }
Example 7
Source File: MDQuaternion.java From MD360Player4Android with Apache License 2.0 | 4 votes |
/** Get the pitch euler angle in degrees, which is the rotation around the x axis. Requires that this quaternion is normalized. * @return the rotation around the x axis in degrees (between -90 and +90) */ public float getPitch () { return getPitchRad() * MathUtils.radiansToDegrees; }
Example 8
Source File: MDQuaternion.java From MD360Player4Android with Apache License 2.0 | 4 votes |
/** Get the yaw euler angle in degrees, which is the rotation around the y axis. Requires that this quaternion is normalized. * @return the rotation around the y axis in degrees (between -180 and +180) */ public float getYaw () { return getYawRad() * MathUtils.radiansToDegrees; }
Example 9
Source File: CCParticleActor.java From cocos-ui-libgdx with Apache License 2.0 | 4 votes |
private float CC_RADIANS_TO_DEGREES(float angle) { return MathUtils.radiansToDegrees * angle; }
Example 10
Source File: ClientPlayer.java From killingspree with MIT License | 4 votes |
private void renderPlayer(SpriteBatch batch) { angle *= MathUtils.radiansToDegrees; if (vY !=0) { walkDuration = 0.49f; } if (Math.abs(vX)> 0.4f) { sprite.setRegion(walk.getKeyFrame(walkDuration)); } else { sprite.setRegion(walk.getKeyFrame(0.49f)); } if ((extra & 0x1) == 0) { sprite.setAlpha(0.5f); } else { sprite.setAlpha(1); } if (angle < -90.1f || angle > 90.1f ) { previousXFlip = true; // Gdx.app.log("true", Float.toString(angle)); } else if (angle > -89.9f && angle < 89.9f ){ // Gdx.app.log("false", Float.toString(angle)); previousXFlip = false; } // Gdx.app.log("angle", Float.toString(angle)); sprite.flip(previousXFlip, false); sprite.setSize(ServerPlayer.WIDTH + 6f, ServerPlayer.HEIGHT + 1f); sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2); float x = position.x - sprite.getWidth() / 2; float y = position.y - sprite.getHeight() / 2 + ServerPlayer.YOFFSET; drawAll(sprite, batch, x, y); renderer.hudRenderer.render(batch, x, y, extra, renderer.stateProcessor. playerNames.players.get(id)); x = position.x - gunSprite.getWidth() / 2; y = position.y - gunSprite.getHeight() / 2 + ServerPlayer.YOFFSET; gunSprite.setRotation(angle); drawAll(gunSprite, batch, x, y); }
Example 11
Source File: Box2dLightTest.java From box2dlights with Apache License 2.0 | 4 votes |
@Override public void render() { /** Rotate directional light like sun :) */ if (lightsType == 3) { sunDirection += Gdx.graphics.getDeltaTime() * 4f; lights.get(0).setDirection(sunDirection); } camera.update(); boolean stepped = fixedStep(Gdx.graphics.getDeltaTime()); Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(camera.combined); batch.disableBlending(); batch.begin(); { batch.draw(bg, -viewportWidth / 2f, 0, viewportWidth, viewportHeight); batch.enableBlending(); for (int i = 0; i < BALLSNUM; i++) { Body ball = balls.get(i); Vector2 position = ball.getPosition(); float angle = MathUtils.radiansToDegrees * ball.getAngle(); batch.draw( textureRegion, position.x - RADIUS, position.y - RADIUS, RADIUS, RADIUS, RADIUS * 2, RADIUS * 2, 1f, 1f, angle); } } batch.end(); /** BOX2D LIGHT STUFF BEGIN */ rayHandler.setCombinedMatrix(camera); if (stepped) rayHandler.update(); rayHandler.render(); /** BOX2D LIGHT STUFF END */ long time = System.nanoTime(); boolean atShadow = rayHandler.pointAtShadow(testPoint.x, testPoint.y); aika += System.nanoTime() - time; /** FONT */ if (showText) { batch.setProjectionMatrix(normalProjection); batch.begin(); font.draw(batch, "F1 - PointLight", 0, Gdx.graphics.getHeight()); font.draw(batch, "F2 - ConeLight", 0, Gdx.graphics.getHeight() - 15); font.draw(batch, "F3 - ChainLight", 0, Gdx.graphics.getHeight() - 30); font.draw(batch, "F4 - DirectionalLight", 0, Gdx.graphics.getHeight() - 45); font.draw(batch, "F5 - random lights colors", 0, Gdx.graphics.getHeight() - 75); font.draw(batch, "F6 - random lights distance", 0, Gdx.graphics.getHeight() - 90); font.draw(batch, "F9 - default blending (1.3)", 0, Gdx.graphics.getHeight() - 120); font.draw(batch, "F10 - over-burn blending (default in 1.2)", 0, Gdx.graphics.getHeight() - 135); font.draw(batch, "F11 - some other blending", 0, Gdx.graphics.getHeight() - 150); font.draw(batch, "F12 - toggle help text", 0, Gdx.graphics.getHeight() - 180); font.draw(batch, Integer.toString(Gdx.graphics.getFramesPerSecond()) + "mouse at shadows: " + atShadow + " time used for shadow calculation:" + aika / ++times + "ns" , 0, 20); batch.end(); } }