Moving player in direction they're looking

Started by Blaziken77mw on

Topic category: Help with MCreator software

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.

Joined Sep 2022
Points:

User statistics:

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


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

Joined Mar 2020
Points:

User statistics:

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

local yaw is a number variable

Joined Apr 2015
Points:

User statistics:

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

This still helps me to this day

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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()));

Joined Nov 2023
Points:

User statistics:

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

Kuri_Pa paste the screenshot I need this

Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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

 

 

 

 

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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?

Joined May 2019
Points:

User statistics:

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

I second the last reply

Joined Apr 2024
Points:

User statistics:

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

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