Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Help
  3. 1st person movement script

1st person movement script

Scheduled Pinned Locked Moved Help
4 Posts 2 Posters 1.3k Views
  • 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.
  • Coder0145C Offline
    Coder0145C Offline
    Coder0145
    wrote on last edited by
    #1

    I am trying to add movement to my first person 3d game, and have made a script for the movement. (I need it to move in the direction the camera is pointing with WASD) I need to get the direction the camera is pointing in order to make you move in the right direction though, and I can’t figure out how. (The direction not accounting for the z axis, It is like a 2d movement script) I have made a script which works, but only when you are facing in the same direction as the y axis and when you face the opposite way everything switches and inverts, and I can’t figure out how to detect when you are facing that way.

    CreatiCodeI 1 Reply Last reply
    1
    • Coder0145C Coder0145

      I am trying to add movement to my first person 3d game, and have made a script for the movement. (I need it to move in the direction the camera is pointing with WASD) I need to get the direction the camera is pointing in order to make you move in the right direction though, and I can’t figure out how. (The direction not accounting for the z axis, It is like a 2d movement script) I have made a script which works, but only when you are facing in the same direction as the y axis and when you face the opposite way everything switches and inverts, and I can’t figure out how to detect when you are facing that way.

      CreatiCodeI Offline
      CreatiCodeI Offline
      CreatiCode
      wrote on last edited by
      #2

      @coder0145

      Please take a look at this tutorial:

      https://www.forum.creaticode.com/topic/312/3d-a-maze-game-difficulty-3

      Coder0145C 1 Reply Last reply
      0
      • CreatiCodeI CreatiCode

        @coder0145

        Please take a look at this tutorial:

        https://www.forum.creaticode.com/topic/312/3d-a-maze-game-difficulty-3

        Coder0145C Offline
        Coder0145C Offline
        Coder0145
        wrote on last edited by
        #3

        @info-creaticode That does work for movement where the camera is controlled with the arrow keys, but I am using pointer lock, where you control the camera with your mouse. I need to get the direction the camera is pointing for my movement script to work in the right direction.

        CreatiCodeI 1 Reply Last reply
        0
        • Coder0145C Coder0145

          @info-creaticode That does work for movement where the camera is controlled with the arrow keys, but I am using pointer lock, where you control the camera with your mouse. I need to get the direction the camera is pointing for my movement script to work in the right direction.

          CreatiCodeI Offline
          CreatiCodeI Offline
          CreatiCode
          wrote on last edited by
          #4

          @coder0145

          In that case, you can use a forever loop to turn the avatar towards the direction of the camera (its “H-Angle” like this:

          3472590d-27cb-47e4-a48b-6bee698a4b07-image.png

          1 Reply Last reply
          1

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • CreatiCode