3d - Jmonkey animation-jump to waypoint -


i’ve been messing while , can not seem find out how this. problem when start motioncontrol, spawn spatial @ first waypoint , move there. however, need make spatial , motion start @ user-defined waypoint (for example: waypoint 10) , go there.

could help?

thanks

the method can find in motionevent changes position on track settime(float). sane values lie between 0.0f (0%) , initialduration (100%).

each time add waypoint motionpath update underlying spline, total length , lengths of each segment.

using information can calculate corresponding "time marks" waypoints:

public float calcwaypointtime(motionpath path, motionevent motionevent, int waypointindex) {     // distance between start , waypoint     float wpdistance = 0;      // sum segment lengths until waypoint reached     list<float> seglen = path.getspline().getsegmentslength();     for(int i=0; i<seglen.size() && i<waypointindex; ++i)         wpdistance += seglen.get(i);      // transform distance time     return (wpdistance / path.getspline().gettotallength()) * motionevent.getinitialduration(); } 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -