Jump to content

Simple Mouse-based Camera


Recommended Posts

Posted (edited)

Converted this recently for someone who was interested in using it. Provides a smooth and fast mouse based Camera using Mouse.move and a lil math to compute where we should be looking.

Gist: https://gist.github.com/Lem0ns/a485f7906db0c08d5458583401a81047

Usage is nearly identical to that standard Camera (will update soon, new ipb throwing me off lol)

Camera lemonCamera = new Camera(script);

lemonCamera.moveNorth(); // Directions
lemonCamera.moveCamera(0, 33); // Moves yaw to 0, pitch to 33
lemonCamera.moveYaw(180); // Moves yaw to 180

lemonCamera.toEntity(npc); // Move camera to entity
lemonCamera.toPosition(position);

lemonCamera.toEntity(futureDest, entity); // Set camera angle before getting to our destination
lemonCamera.toEntity(futureDest, position);

 

Finally, thanks to @Ethan07 for the inspiration to make this class. His Camera can be seen here.

 

Edited by Lemons
  • Like 11

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...