Posted May 21, 201510 yr Hi , I am trying to make the player orbit around a block. I would like to have the player always face the block at the center of the orbit. I've been messing around with: player.setPosition(x, y, z); player.setPositionAndRotation(x, y, z, yaw, pitch); player.setPositionAndUpdate(x, y, z); player.setLocationAndAngles(x, y, z, yaw, pitch); Setting the position seems to be working ok. I am having problems setting the direction the player is looking. Ideally I would be looking for something like: player.setLocation(double x, double y, double z); player.facePosition(BlockPos pos); When you hit f5, minecraft behaves like this, except I want a block at the center of the view. Any help is appreciated
May 21, 201510 yr I suppose some mathematic calculations should be applyed to get pitch and yaw. double x = player.posX - blockPos.getX() - 0.5; double y = player.posY - blockPos.getY() - 0.5; double z = player.posZ - blockPos.getZ() - 0.5; double pitch = Math.atan2(-y, Math.sqrt(x*x+z*z)); double yaw = Math.atan2(z, -x); I forget the sign before x and y . You may try twice and get the correct ones. Author of Tao Land Mod. http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img] Also, author of RenderTo ---- I'm not an English native speaker. I just try my best.
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.