Jump to content

Simple Mouse-based Camera


Lemons

Recommended Posts

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
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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