1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How can I make an entity move

Discussion in 'Development' started by Minetron26, Sep 10, 2018.

Thread Status:
Not open for further replies.
  1. Minetron26

    Minetron26 Witch

    Messages:
    55
    GitHub:
    minetron26
    Hello, I was wondering if I can make an entity move, preferably to follow you, for example, I create a user entity or NPC and then I want to make it move and followed the user him, is there any way to do this?
     
  2. XenialDan

    XenialDan Baby Zombie

    Messages:
    141
    GitHub:
    thebigsmilexd
    The function to make mobs move is ->addMotion(v3)

    With some calculations you can get the rotation angle right too, basically cosinus and sinus (cos sin). Search the web for triangular calculations

    Gravity is done automatically, just jumping must be implemented maybe. Speed calculation can be done by multiplying the motion vector with a speed value. Take a look at MyPets for example code
     
    SleepSpace9, GamakCZ and jasonwynn10 like this.
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.