jps0611

Custom camera...moving camera forward/backward at current rotation?

Recommended Posts

Howdy,

I'm building a custom camera controller using the CameraDirection and CameraRotation in order to preserve the inherent camera inertia. How the heck do I move the camera forward/backward using CameraDirection at the current Camera Rotation?

Thanks!

JPS

Share this post


Link to post
Share on other sites

Not as efficient, but you can also do some one liners with Vector3 Methods (untested):

camera.cameraDirection.addInPlace(
   new Vector3(Math.sin(camera.rotation.y), 0, Math.cos(camera.rotation.y)).scale(forward ? 1 : -1)
);

note: if you are building something to share, I think the Z needs to be inverse on right-handed scenes.

Share this post


Link to post
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.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.