HOW TO A NML MODEL CAR in mapview

34 views
Skip to first unread message

Carlos Harlens Valdes Mederos

unread,
Feb 2, 2017, 10:20:04 AM2/2/17
to Nutiteq-dev
Hi Guys,

Do you know how to achieve a car 3d model just going from one point to another?

I tried an analogous solution (marker animation) which sets nineoldandroid non result.


Please help!


Jaak Laineste

unread,
Feb 2, 2017, 10:29:11 AM2/2/17
to nutit...@googlegroups.com
It should be like marker animation : set position with timer. Can you share your code?

Jaak
(Sent from mobile)
--
You received this message because you are subscribed to the Google Groups "Nutiteq-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nutiteq-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carlos Harlens Valdes Mederos

unread,
Feb 2, 2017, 1:42:34 PM2/2/17
to Nutiteq-dev
Hi Jaak,

Basically it is the same snippet as marker animation's.

But, once at runtime, nml model just dissapear!!! cant find it anywhere.


supose all layers have been created and so...


check code below:



public void animaCarro(NMLModel car){

// Define start and end keyframes
MapPos markerLocation0 = mapView.getOptions().getBaseProjection().fromWgs84(new MapPos(13.38933, 52.51704));
MapPos markerLocation1 = mapView.getOptions().getBaseProjection().fromWgs84(new MapPos(-82.141900, 23.1101));


Keyframe[] markerLocationKeyframes = new Keyframe[] {


Keyframe.ofObject(0.0f, markerLocation0),
Keyframe.ofObject(1.0f, markerLocation1)
};



// Create property values holder for "mapPos" property and set custom evaluator for MapPos type
PropertyValuesHolder markerLocationPVHolder = PropertyValuesHolder.ofKeyframe("pos", markerLocationKeyframes);

markerLocationPVHolder.setEvaluator(new TypeEvaluator() {

public Object evaluate(float fraction, Object startValue, Object endValue) {
MapPos pos0 = (MapPos) startValue;
MapPos pos1 = (MapPos) endValue;
return new MapPos(pos0.getX() + (pos1.getX() - pos0.getX()) * fraction, pos0.getX() + (pos1.getY() - pos0.getY()) * fraction);
}
});

// Create object animator for the marker using marker PVH and start the animation
ObjectAnimator animator = ObjectAnimator.ofPropertyValuesHolder(car, markerLocationPVHolder);
animator.setDuration(10000); // duration 10s
// Make it to bounce
animator.setInterpolator(new AccelerateInterpolator());
animator.start();


}

Carlos Harlens Valdes Mederos

unread,
Feb 2, 2017, 2:31:04 PM2/2/17
to Nutiteq-dev
Hi Jaak,

Any idea about issue?

best regards!
Reply all
Reply to author
Forward
0 new messages