Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    First person camera w/ mouse controls

    Help
    2
    4
    21
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      Remi Calixto last edited by

      I’m making a fps (first person shooter), and I want the view to move with the mouse, but not have to click, like in free mode, have a limit to the v angle in which the camera looks at. and make the player move forward only based on the Z-rotation, not the x or y.

      info-creaticode 1 Reply Last reply Reply Quote 0
      • info-creaticode
        CreatiCode @remi.1286167-510cee35 last edited by info-creaticode

        @remi-1286167-510cee35

        This seems very similar to the Minecraft demo, where you use “lock pointer” to control the camera view using the mouse pointer:

        play.creaticode.com/projects/660aa865b57a3da838c387bc

         
        To lock the vertical angle, a simple trick is to repeatedly set the camera’s v-angle to 90 degrees whenever it is not:

        5e72b248-fd89-46ad-9d2b-d350b5927689-image.png

        R 1 Reply Last reply Reply Quote 0
        • R
          Remi Calixto @info-creaticode last edited by remi.1286167-510cee35

          @info-creaticode How would I change my follow camera’s v-
          rotation?

          info-creaticode 1 Reply Last reply Reply Quote 0
          • info-creaticode
            CreatiCode @remi.1286167-510cee35 last edited by

            @remi-1286167-510cee35

            If you use the pointer lock, the v-angle will be automatically changed. But you said you want to limit the v-angle?

            If you want it to move freely but within a range, you can still use the same block to set the v-angle whenever it is outside the range.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post