August 3, 201510 yr Ok so, any ideas why this doesn't want to move the camera ? NPC npc = getNpcs().closest(npcFitler); CameraEntityEvent ce = new CameraEntityEvent(npc); execute(ce); Edited August 3, 201510 yr by iJodix
August 3, 201510 yr Ok so, any ideas why this doesn't want to move the camera ? CameraEntityEvent ce = newCameraEntityEvent(npc); NPC npc = getNpcs().closest(npcFitler); maybe you should put a space between "newCameraEntityEvent" i could be wrong dou
August 3, 201510 yr Author maybe you should put a space between "newCameraEntityEvent" i could be wrong dou Oh sorry, i re-wrote the code to the thread so made a typo. Edited August 3, 201510 yr by iJodix
August 3, 201510 yr Oh sorry, i re-wrote the code to the thread so made a typo. i always had trouble with #execute(Event e); my solution was: this.getBot().getEventExecutor().execute(ce); Hope this helps! Precise.
August 3, 201510 yr Author i always had trouble with #execute(Event e); my solution was: this.getBot().getEventExecutor().execute(ce); Hope this helps! Precise. Ok, it .. kinda moves the camera ? Like few pixels .. I don't have any issues with executing the MoveMouseEvent Edited August 3, 201510 yr by iJodix
August 3, 201510 yr The camera class seems to be broken at the moment, manually setting the Yaw or using toEntity/toPosition doesn't work 99% of the time.
August 3, 201510 yr try this /* * Rotate the camera to an entity; Based on angle calculations */ public void cameraToEntity(Entity e) { cameraToPosition(e.getPosition()); } /* * Rotate the camera to a Position; Based on angle calculations */ public void cameraToPosition(Position p) { Position pos = myPosition(); int angle = 90 + (int) Math.toDegrees(Math.atan2(-(p.getY() - pos.getY()), p.getX() - pos.getX())); int yaw = angle < 0 ? Math.abs(angle) : 360 - angle; CameraYawEvent evt = new CameraYawEvent(yaw); execute(evt.setBlocking()); } EDIT: or just try to set whatever camera event you're using to be blocking (Event#setBlocking) before executing it. Edited August 3, 201510 yr by FrostBug
August 3, 201510 yr Author try this /* * Rotate the camera to an entity; Based on angle calculations */ public void cameraToEntity(Entity e) { cameraToPosition(e.getPosition()); } /* * Rotate the camera to a Position; Based on angle calculations */ public void cameraToPosition(Position p) { Position pos = myPosition(); int angle = 90 + (int) Math.toDegrees(Math.atan2(-(p.getY() - pos.getY()), p.getX() - pos.getX())); int yaw = angle < 0 ? Math.abs(angle) : 360 - angle; CameraYawEvent evt = new CameraYawEvent(yaw); execute(evt.setBlocking()); } EDIT: or just try to set whatever camera event you're using to be blocking (Event#setBlocking) before executing it. Thank you! Edited August 3, 201510 yr by iJodix
August 3, 201510 yr try this /* * Rotate the camera to an entity; Based on angle calculations */ public void cameraToEntity(Entity e) { cameraToPosition(e.getPosition()); } /* * Rotate the camera to a Position; Based on angle calculations */ public void cameraToPosition(Position p) { Position pos = myPosition(); int angle = 90 + (int) Math.toDegrees(Math.atan2(-(p.getY() - pos.getY()), p.getX() - pos.getX())); int yaw = angle < 0 ? Math.abs(angle) : 360 - angle; CameraYawEvent evt = new CameraYawEvent(yaw); execute(evt.setBlocking()); } EDIT: or just try to set whatever camera event you're using to be blocking (Event#setBlocking) before executing it. Been a long time since I saw the atan2 function lol.
Create an account or sign in to comment