iJodix Posted August 3, 2015 Share Posted August 3, 2015 (edited) 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, 2015 by iJodix Quote Link to comment Share on other sites More sharing options...
itzDot Posted August 3, 2015 Share Posted August 3, 2015 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 Quote Link to comment Share on other sites More sharing options...
iJodix Posted August 3, 2015 Author Share Posted August 3, 2015 (edited) 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, 2015 by iJodix Quote Link to comment Share on other sites More sharing options...
Precise Posted August 3, 2015 Share Posted August 3, 2015 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. Quote Link to comment Share on other sites More sharing options...
iJodix Posted August 3, 2015 Author Share Posted August 3, 2015 (edited) 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, 2015 by iJodix Quote Link to comment Share on other sites More sharing options...
Flamezzz Posted August 3, 2015 Share Posted August 3, 2015 camera#toEntity isn't working either? Quote Link to comment Share on other sites More sharing options...
Zee Best Posted August 3, 2015 Share Posted August 3, 2015 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. Quote Link to comment Share on other sites More sharing options...
FrostBug Posted August 3, 2015 Share Posted August 3, 2015 (edited) 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, 2015 by FrostBug 3 Quote Link to comment Share on other sites More sharing options...
iJodix Posted August 3, 2015 Author Share Posted August 3, 2015 (edited) 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, 2015 by iJodix Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted August 3, 2015 Share Posted August 3, 2015 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. Quote Link to comment Share on other sites More sharing options...