Moving a spatial between waypoints through other waypoints

Hi,

Im trying to let a spatial move between waypoints, like move from location A to to D through C. I am familiar with motions paths. But i have around 700 waypoints where multiple spatials need too move between and through. So i am looking for a way too let the spatials move between those fixed waypoints. Also, is there another way too make a waypoint without having too attach it too a path?

I made the waypoints like this:

        float a = 0;
        float aa = 0;
        float aaa = 0;
        float aaaa = 0;
        path = new MotionPath();
        for (int i = 0; i < 79; i++) {
        path.addWayPoint(new Vector3f(-58, 0.13f, 159f - a));
        a = a+4f;  
        }
        for (int i = 0; i < 81; i++) {
        path.addWayPoint(new Vector3f(-62f, 0.13f, 163f - aa));
        aa = aa+4f;  
        }
        for (int i = 0; i < 83; i++) {
        path.addWayPoint(new Vector3f(-66f, 0.13f, 167f - aaa));
        aaa = aaa+4f;  
        }
        for (int i = 0; i < 85; i++) {
        path.addWayPoint(new Vector3f(-70f, 0.13f, 171f - aaaa));
        aaaa = aaaa+4f;  
        }
        float b = 0;
        float bb = 0;
        float bbb = 0;
        float bbbb = 0;
        for (int i = 0; i < 79; i++) {
        path.addWayPoint(new Vector3f(58, 0.13f, 159f - b));
        b = b+4f;    
        }
        for (int i = 0; i < 81; i++) {
        path.addWayPoint(new Vector3f(61, 0.13f, 163f - bb));
        bb = bb+4f;    
        }
        for (int i = 0; i < 83; i++) {
        path.addWayPoint(new Vector3f(64, 0.13f, 167f - bbb));
        bbb = bbb+4f;    
        }
        for (int i = 0; i < 85; i++) {
        path.addWayPoint(new Vector3f(67, 0.13f, 171f - bbbb));
        bbbb = bbbb+4f;    
        }
        path.enableDebugShape(assetManager,rootNode);

I’d like to make someting that will move a spatial between waypoint(300) to waypoint(350) through waypoint(325).

Thanks in advance.

sorry I miss something what is wrong with motion path

there are 36 spatials that need too be moved between those waypoints, spatials that carry other spatials between waypoints. so 1 of those spatials moves multiple times between those waypoints in different way, because he makes multiple rides. so if i had to make one motianpath for every ride a spatial makes, then it would mean i had too make thousands of motianpaths if i understand correctly. So thats why i am looking for another/simpler way.

i should’ve said this clearer in the main post, sorry.

you still have the options to do the translation on update by changing the spatial location values as per the direction between the two points, but in my case i will choose the motionpath it is very useful and smart tool, to do the math for you.

Ok I will tell u my case and it might be useful for you as well, in my case I need an NPC to follow the player and take side to unblock the path way, so every new way point is calculated during the update, so my case is number of motion paths is infinity.

So What I make is using one path and add way point to it depending on the new location of the player or the target location to unblock the player path, also I remove the old way points to avoid funky movements.

The MotionEvent contains useful function like pause, stop and play and event listener in case hitting the way.

Also depending on your use case you could use two motion path in two direction with the same way points and go forward and backward by switching between them.

I hope you find those hints useful, I am newbie it might be more useful tools I am not aware of

1 Like