Attempt to make entity find path and move to xyz works on very low speed, is there any other ways to do this?

Started by vlonabuser on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Attempt to make entity find path and move to xyz works on very low speed, is there any other ways to do this?

I've tried built-in pathfinding procedure and homing missle procedure from forum but they are very slow.

So, my entity is flyng and like an projectile that aims for 10 ticks and then flies to players last xyz to attack and if it collides with him it explodes and despawns , if not it despawns with a small explode, but with built-in pathfinding procedure it just flies down and only then start to pursue player, but i need it to fly right to player. Briefly speaking mcreator pathfinding procedure doesnt use speed and forums homing procedure either dont do it, so is there any variants?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
One thing you could try for…
Sat, 11/04/2023 - 18:06

One thing you could try for a missile is using velocities instead of pathfinding, which would allow you to customize the speed and accuracy of the missile. (Though this would be more complicated.) 

The basic idea would be to have a homing missile constantly running a procedure that checks if a player is in a large radius, and, if it finds a player, forces itself to look at the nearest player in the radius, and then sets its velocity to the x/y/z look angle vectors of the missile. (The individual components of the vector of the entity's look direction- you don't have to totally understand how this works, suffice it to say that using the 'Attempt to Override Motion Vector of (entity)' block, and then plugging in the x/y/z look angle vectors will cause an entity to move in the direction it's looking at.) If it can no longer find a player, you presumably want the velocity to remain unchanged, and would thus instead override the entity's motion vector to its current x/y/z velocities.

There are other ways you can mess with this; for example, multiplying all three of the x/y/z look angle vectors will still move the entity in the direction it's looking, but will increase the speed. (Whereas multiplying by decimals will slow it down.) If you wanted the missile to gradually accelerate, you could add the x/y/z look angle vectors to the existing x/y/z values of the entity's velocity. 

This is kind of a complicated concept, so I could totally send some screenshots if that would help.

Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thank you very much it…
Sun, 11/05/2023 - 17:13

thank you very much it worked!