Ex0rcism Posted June 5, 2019 Share Posted June 5, 2019 So for some reason I cannot set the camera to move to specific pitch and yaw degrees. Everytime I do I get different results on current pitch and yaw.My Code: if (camera != null) { targetPitch = random(22, 67); targetYaw += 1; camera.movePitch(targetPitch); camera.moveYaw(targetYaw); log("Camera moved successfully to position [Current(Pitch: " + camera.getPitchAngle() + ", Yaw:" + camera.getYawAngle() + "), Target(Pitch: " + targetPitch + ", Yaw: " + targetYaw + ")]"); return; } Results (Log): Camera moved successfully to position [Current(Pitch: 24, Yaw: 0), Target(Pitch: 25, Yaw: 7)] Camera moved successfully to position [Current(Pitch: 33, Yaw: 1), Target(Pitch: 33, Yaw: 8)] Camera moved successfully to position [Current(Pitch: 58, Yaw: 3), Target(Pitch: 57, Yaw: 9)] Is there a way I can get it to the specific target, so I'm able to do a check with a boolean statement? Quote Link to comment Share on other sites More sharing options...
zwaffel Posted June 5, 2019 Share Posted June 5, 2019 (edited) camera.movePitch() and camera.moveYaw() both return boolean so you can use them in an if statement. if you want to turn to a target or position you can use toEntity or toPosition . More info here. https://osbot.org/api/org/osbot/rs07/api/Camera.html You're using a random number for your pitch and your target yaw is just your old value +1. If you want to test a specific location put a specific number as your target. Edited June 5, 2019 by zwaffel Quote Link to comment Share on other sites More sharing options...
Neanel Posted June 5, 2019 Share Posted June 5, 2019 Those functions have a margin of +-6, I believe. But as zwaffel mentioned both return a boolean either way. Or you could check if the currentPitch is within 6 of the targetPitch. Or you could keep recalling the function until it has the exact position you want. Quote Link to comment Share on other sites More sharing options...
Ex0rcism Posted June 7, 2019 Author Share Posted June 7, 2019 On 6/5/2019 at 6:23 PM, zwaffel said: camera.movePitch() and camera.moveYaw() both return boolean so you can use them in an if statement. if you want to turn to a target or position you can use toEntity or toPosition . More info here. https://osbot.org/api/org/osbot/rs07/api/Camera.html You're using a random number for your pitch and your target yaw is just your old value +1. If you want to test a specific location put a specific number as your target. That actually helped me knowing it was a boolean statement, but it did not solve trying to set the actual pitch and yaw to it's specific target. On 6/5/2019 at 6:50 PM, Neanel said: Those functions have a margin of +-6, I believe. But as zwaffel mentioned both return a boolean either way. Or you could check if the currentPitch is within 6 of the targetPitch. Or you could keep recalling the function until it has the exact position you want. Recalling the function doesn't help any, still ends up being the same, and yeah currently working on a fix for when the camera stops moving to return another boolean as true, hopefully this will solve my issue. Quote Link to comment Share on other sites More sharing options...