teplov.ivan Posted May 25, 2016 Share Posted May 25, 2016 Здравствуйте, есть ли возможность, используя функционал юниджайна, перемещать множество различных нод по одной траектории с заданным расстоянием между ними (например, плотное движение автомобилей по шоссе)? При использовании системы городского трафика возникают проблемы с количеством автомобилей: при ~300 автомобилях уже значительно снижается производительность. Конечная цель - перемещать около 1000 низкополигональных моделей автомобилей по заданным траекториям без продвинутой и сложной логики. Link to comment
silent Posted May 25, 2016 Share Posted May 25, 2016 Hi Ivan, You can achieve it with a help of WorldTransformPath object. Corresponding sample is located in SDK Browser -> Samples -> UnigneScript -> World Management -> path_00. You can also check how we solved similar task in our Port Angeles demo (check the Airplane class constructor - Airplane(int t,int p) at the very beginning of portangeles.h script). We've added several splines (*.path file) and assigned random airplane NodeRefrences to the random splines. Node position on spline can be set via setTime() method, but we used random time value. Thanks! 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
teplov.ivan Posted June 28, 2016 Author Share Posted June 28, 2016 silent спасибо! Данный способ работает, но при количестве объектов около 600 и более наблюдается сильное снижение производительности. Вот показания профайлера при 1000 объектов и 40 путей для них: пути и объекты выбираются случайно как и в демо Port Angeles. Как вы думаете, есть ли какие нибудь способы оптимизировать данный способ, или же прибегнуть к написанию с нуля подобной системы движения? Link to comment
silent Posted June 29, 2016 Share Posted June 29, 2016 Hi Ivan, For objects that are moved with splines it's better to disable physics (collisions / intersections / bodies) - I can see that physics update is very high on your screenshot. Also, maybe it will be a good idea to not update splines that are currently not in the viewing frustum to save the performance and disable very distant objects from rendering. How to optimize that - it depends on your usage, but not rendering and not updating objects that are currently not in the viewing frustum is a good start. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
teplov.ivan Posted July 12, 2016 Author Share Posted July 12, 2016 Silent, здравствуйте. Для всех объектов, движущихся по сплайнам выключена физика (collisions / intersections / bodies), все маски выставлены на 0, и всё равно physics update очень высокий. Попробовал собрать упрощенную сцену, physics update стал в пределах нормы, но общий update всё равно очень высокий. unigine_project.rar Link to comment
teplov.ivan Posted July 12, 2016 Author Share Posted July 12, 2016 How to optimize that - it depends on your usage, but not rendering and not updating objects that are currently not in the viewing frustum is a good start. Silent Спасибо, удалось достигнуть желаемого результата данным способом. Link to comment
Recommended Posts