Moving player in direction they're looking

Started by Blaziken77mw on

Topic category: Help with MCreator software

Active 3 years ago
Joined Jul 2021
Points:
563

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 0
Moving player in direction they're looking

I'm trying to make an item that moves the player in the direction they are looking when they hold right click, but I haven't been able to find a way to get the direction they're looking into the motion vector

Active 4 years ago
Joined Jul 2021
Points:
589

User statistics:

  • Modifications: 0
  • Forum topics: 5
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 17
I have a code that makes the…
Fri, 07/23/2021 - 11:01

I have a code that makes the player gain momentum towards the direction they are looking.

maybe it will help you.

You only have to copy the code that is marked in red, you leave it, it does not work for you.
code

Active 4 years ago
Joined Jul 2021
Points:
589

User statistics:

  • Modifications: 0
  • Forum topics: 5
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 17
Explanation: You can't get a…
Fri, 07/23/2021 - 11:04

Explanation: You can't get a vector, since there are no procedural blocks that do it (with code maybe), but you can get the Angle at which Steve's head turns (Yaw), only with a simple transformation you can get the unit vector of X and Z shown in the image.

Active 1 year ago
Joined Sep 2022
Points:
401

User statistics:

  • Modifications: 0
  • Forum topics: 3
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 3
what category is the [set…
Mon, 01/02/2023 - 17:16


what category is the [set local yaw to] block in?

Active 1 year ago
Joined Mar 2020
Points:
1534

User statistics:

  • Modifications: 7
  • Forum topics: 17
  • Wiki pages: 0
  • MCreator plugins: 3
  • Comments: 1303
local yaw is a number…
Mon, 01/02/2023 - 20:15

local yaw is a number variable

Active 1 year ago
Joined Apr 2015
Points:
1027

User statistics:

  • Modifications: 0
  • Forum topics: 51
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 110
This still helps me to this…
Thu, 03/16/2023 - 03:46

This still helps me to this day

Active 4 months ago
Joined May 2022
Points:
465

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 6
I'm not sure how to do it…
Thu, 03/16/2023 - 04:17

I'm not sure how to do it with procedural blocks, but the code goes something like
player.setDeltaMovement(player.getDeltaMovement().add(player.getForward()));

Active 1 year ago
Joined Nov 2023
Points:
156

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
Kuri_Pa paste the screenshot…
Wed, 11/29/2023 - 13:13

Kuri_Pa paste the screenshot I need this

Active 1 year ago
Joined Nov 2023
Points:
156

User statistics:

  • Modifications: 0
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 5
guy I dont know Imy plugin…
Wed, 11/29/2023 - 15:05

guy I dont know Imy plugin changed but I think I solve it if anyone need this is the solution (I install player animation plugin and gecko lib and I use 1.20.1 version)

 

https://imgur.com/gallery/uCDmfSg

 

 

 

 

Active 7 months ago
Joined Apr 2024
Points:
114

User statistics:

  • Modifications: 1
  • Forum topics: 0
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 4
I got it to work apart from…
Sat, 05/11/2024 - 21:22

I got it to work apart from y, how do I make the player move in the y direction as well?

Active 10 months ago
Joined May 2019
Points:
742

User statistics:

  • Modifications: 0
  • Forum topics: 13
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 25
I second the last reply
Sun, 06/16/2024 - 23:37

I second the last reply

Active 2 months ago
Joined Apr 2024
Points:
127

User statistics:

  • Modifications: 1
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 4
where would i find the "set…
Fri, 08/30/2024 - 04:43

where would i find the "set local yaw" block?

 

Active 4 hours ago
Joined Aug 2025
Points:
17

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
just makes me barely jump...
Wed, 10/08/2025 - 17:51

just makes me barely jump...

Active 4 hours ago
Joined Aug 2025
Points:
17

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 8
seems as if i need to link…
Wed, 10/08/2025 - 17:51

seems as if i need to link pitch and yaw to well- pitch and yaw.