java - LibGDX 3d follow a object or point -
I have trouble with rotation object in direction of direction.
I need to rotate ModelInstance (the example code) Point or ModelIstance.
But when I use a setToLookAt it always resets my conversion.
Variables:
Status of private vectors 3 ; Private Arrestist & lt; Vector 3 & gt; Path; Private int presentpaypoint id = 0; Private vector 3 direction = new vector 3 (); Private vector 3 TMPV2 = new vector 3 (), TMPV1 = new vector 3 (); Speed of private float;
Update method:
Public Zune update (Float Delta) {if (path! = Null) {transform.getTranslation (tmpV2); TmpV1 = PathGet (currentVKIID). Cpy (); If (tmpV1.dst (tmpV2) & lt; 2) {currentWaypointId ++; If (currentWaypointId> = path.size ()) currentWaypointId = 0; TmpV1 = PathGet (currentVKIID). Cpy (); } Direction = (tmpV1) .sub (tmpV2) .nor (); Transform.translate (direction.scl (speed * delta)); }}
for the answer Thanks
Comments
Post a Comment