jerome Posted February 7, 2018 Share Posted February 7, 2018 Hi Folks, Here's a SPS new feature : the particle parenting. Simple to understand : once a particle has a parent, all its rotation, position and pivot are then expressed in the parent particle local space. Simple to use : sps.initParticles = function() { for (var i = 1; i < sps.nbParticles; i++) { // declare each previous particle as the parent of the current one sps.particles[i].parentId = i - 1; } }; sps.updateParticle = function(p) { // each particle will rotate for +0.001 in the already rotated parent space particle.rotation.z += 0.001; } examples : the green box is parented to the translating red one, it also rotates around a local pivot http://jerome.bousquie.fr/BJS/test/spsParenting.html 600 boxes, parented per groups (stems) of 10, each rotating around its pivot : http://jerome.bousquie.fr/BJS/test/spsParenting2.html PhilT, adam, Wingnut and 6 others 9 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted February 7, 2018 Share Posted February 7, 2018 Excellent feature, Jerome! Thank you!!! Quote Link to comment Share on other sites More sharing options...
jerome Posted February 7, 2018 Author Share Posted February 7, 2018 you're welcome Quote Link to comment Share on other sites More sharing options...
Guest Posted February 7, 2018 Share Posted February 7, 2018 AS always it rocks! Quote Link to comment Share on other sites More sharing options...
jerome Posted February 8, 2018 Author Share Posted February 8, 2018 Some PG demo coming soon Meanwhile, a little crowd of 300 guys walking around in one draw call : http://jerome.bousquie.fr/BJS/test/spsParenting3.html satguru, GameMonetize and JackFalcon 3 Quote Link to comment Share on other sites More sharing options...
JohnK Posted February 27, 2018 Share Posted February 27, 2018 An adaptation of @jerome's demo above with elbows and knees https://tender-murdock-275855.netlify.com/ GameMonetize and jerome 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted February 27, 2018 Author Share Posted February 27, 2018 excellent !!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.