本文主要是介绍利用Skyline6.5的接口实现模型路径漫游,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
楼主也是刚开始接触Skyline开发,文中若有错误还望指出,话不多说,upupup.
实现模型动态漫游,主体就是三个步骤考虑:
(a)模型加载
(b)规划路径
(c)将路径添加给模型对象
直接上全部代码:
function run_3d() {//绘制路径
//将路径以折线展示在skyline中
// var cVerticesArray = [0.79051472222223, 0.52489722222222, 500,
// 90.79051472221223, 0.52489722212222, 500,
// 145.79051472220223, 0.52489722202222, 500,
// 179.79051472220923, 0.52489722209222, 500, ];
//
//
// pILineString = SGWorld.Creator.GeometryCreator.CreateLineStringGeometry(cVerticesArray);
// color = SGWorld.Creator.CreateColor(255, 0, 0, 125);
// var polyline = SGWorld.Creator.CreatePolyline(pILineString, color);//加载3d模型;CreateDynamicObject接口第三、四个参数绑定在一起;传的0表示我传的3d模型,第四个就是加载模型的具体路径了,var dynamicObject = SGWorld.Creator.CreateDynamicObject(0, 1, 0, "filepath", 1000, 0, 0, "动态对象");//规划模型具体路径;var wayPoint1 = SGWorld.Creator.CreateRouteWaypoint(0.79051472222223, 0.52489722222222, 1000000, 8000000);var wayPoint2 = SGWorld.Creator.CreateRouteWaypoint(90.79051472221223, 0.52489722212222, 1000000, 8000000);var wayPoint3 = SGWorld.Creator.CreateRouteWaypoint(145.79051472220223, 0.52489722202222, 1000000, 8000000);var wayPoint4 = SGWorld.Creator.CreateRouteWaypoint(179.79051472220923, 0.52489722209222, 1000000, 8000000);//将飞行路径传给动态模型dynamicObject.Waypoints.AddWaypoint(wayPoint1);dynamicObject.Waypoints.AddWaypoint(wayPoint2);dynamicObject.Waypoints.AddWaypoint(wayPoint3);dynamicObject.Waypoints.AddWaypoint(wayPoint4);//CircularRoute的true值表示执行完当前一次完整路由再继续执行,dynamicObject.CircularRoute = true;dynamicObject.RestartRoute(0);SGWorld.Navigate.FlyTo(dynamicObject);}
调用之后,我们可以看看效果!
加上定时器不断触发之后:
这篇关于利用Skyline6.5的接口实现模型路径漫游的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!