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

[SOLVED] Calculate uniformly accelerated entity motion

Discussion in 'Development' started by CreeperFace, Dec 2, 2016.

  1. CreeperFace

    CreeperFace Witch

    Messages:
    58
    GitHub:
    creeperface01
    Hi i want to calculate time and distance of entity. (i know initial motion, and friction)
    @SOFe already tried to help me but he probably didn't understand me :D

    PHP:
    while (abs($motionX) > 0.1) {
        
    $x += $motionX;
        
    $motionX *= 0.98;
        
    $timeX++;
    }
    i used this to calculate it but its bad method..
    So initial motion is motionX and final motion is 0.1

    i would like to calculate time, how long it takes than entity motion will be 0.1 and how long path travel in this time.
     
    Last edited: Dec 2, 2016
  2. CreeperFace

    CreeperFace Witch

    Messages:
    58
    GitHub:
    creeperface01
    is it right?
    PHP:
    $timeX log(($friction $finalSpeed) / abs($motionX)) / log($friction);
    $distanceX $motionX * ((- ($friction ** $timeX)) / ($friction));
     
    Last edited: Dec 2, 2016
  3. CreeperFace

    CreeperFace Witch

    Messages:
    58
    GitHub:
    creeperface01
    OK solved probably :D
     
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    What was the soloution?
    Others with the same question will not be able to get help by using this thread...
     
  5. CreeperFace

    CreeperFace Witch

    Messages:
    58
    GitHub:
    creeperface01
    my calculation
     
  6. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
  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.