A little overview in how to align an object in Thinking Particles to compensate a ball over him so never fall down.
This video is based on this cool video from kosolax, that at the same time is based in this ICE video from Danil Krivoruchko. I was very curious how to create the rotation compensation for the ball so I give it a try. At the end was much easier that what I was thinking initially and this was done in less than 4 hours. I was not looking for a fancy look, only going around the more technical part of the problem, so no nice video.
Here you can see the setup to rotate the platform (square) to the ball. I use a PPassAB filtering by “only the nearest” so every platform takes in acount only the most near ball. I read the direction between the ball and the platform center with a “distance” node. With a “Math” I create the “deflector” between this vector and (0,0,1) vector and feed this on “direction” “alignment” node. And voila! The platform will compensate always the ball position.
So thats it! for the rest is a mix of using Iterators and be very carefull seting reference between objects and Pattach. For the array of the pistons in circular form you can use this expression:
ppos is the position of every “platform” you have the circular radius and the “a” is the number of pistons. This duplicates the last piston with the first one, the easiest way is to delete after “pistons” based in a distance. (Thanks to Fabian Buckreus) for pointing some light here.
The other challenge I found doing this was in the pistons offset, You have to rotate the superior pistons connection from his base, but at the same time stablish a reference between superior and inferior part. Finally I create a new particle “a helper” on the middle of every circle of pistons, Pattach the end of the pistons to this helper, rotate the helper using an alignment and finally Pattach this helper to the platform and works quite well.