java - OpenGL Third Person Camera cant combine axes correctly -



java - OpenGL Third Person Camera cant combine axes correctly -

i seek implement 3rd person photographic camera in opengl , seem done. can rotate around y axis , x+z axis. when seek both @ 1 time doesn't looks because doesn't @ object anymore. can figure out error is? heres code:

gltranslatef(world.player.x-4.5f,world.player.y-4.5f,world.player.z-20f-4.5f); modelhandler.modellist.get("test").render(); double camerax = 20 * math.cos((world.player.getyaw() + 270.0f) * math.pi / 180) * math.cos(math.toradians(world.player.getpitch())) + world.player.x; double cameray = 20 * math.sin((world.player.getpitch()) * math.pi / 180) + world.player.y; double cameraz = 20 * math.sin((world.player.getyaw() - 270.0f) * math.pi / 180) * math.cos(math.toradians(world.player.getpitch())) + world.player.z-20; glrotatef(360.0f - world.player.getyaw(), 0.0f, 1.0f, 0.0f); glrotatef(world.player.getpitch() * (float)math.cos(math.toradians(360.0f - world.player.getyaw())), 1.0f, 0.0f, 0.0f); glrotatef(world.player.getpitch() * (float)math.sin(math.toradians(360.0f - world.player.getyaw())), 0.0f, 0.0f, 1.0f); gltranslated(-camerax, -cameray, -cameraz); // render world , stuff

java opengl 3d

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -