# Pflow Box 3 Collision Avoidance "Boids"

 04 April 2013 #1 mstarktv Frequenter   portfolio Michael Stark FX artist Pixomondo USA   Join Date: Dec 2012 Posts: 100 Pflow Box 3 Collision Avoidance "Boids" After messing around with orbits from my last post, I got the hankering to do some flocking. I thought at first to use TP, but, Pflow (For me) I find is much quicker and simpler to get a flocking system. All due to "keep apart" because I can mess with core radius of 2 keep apart's to repel close particles and attract far particles to average them out. Now, I am stuck trying to figure out a way to have the particles avoid an object/obstacle. I have an example here: All the flocking mechanics are at play, It's following a negative wind for now as it's "goal". And my Box 3 setup that is just not working - with my thought process below: I haven't used Box 3 in awhile so I'm a bit rusty. But, here is what is going on in this flow. I'm basically trying to take the closest particle to the object's surface and have it change direction (using the Vector Product). I'm using a condition with a pipe to say that if the position is less than 5(it's a random number for testing) - then change the speed vector. This is not working at all and is causing quite the mess. I feel like I'm in the area of getting it to work but eh... I want to refine the entire thing once I get this down. It was suggested to use forces/collision to repel it, but I'd much rather have a preset that I can point and click objects for avoidance. Sorry for overloading this forum lately, as always, I hope I wasn't speaking gibberish. share quote
 04 April 2013 #2 3ak Know-it-All   Join Date: Dec 2002 Posts: 495 Maybe you can use normalize ( cross ( cross ( surface_normal, particle_velocity ), surface_normal)) * length (particle_velocity) to get velocity, tangential to surface with the same speed as it was (pseudocode). EDIT: And i think it's quite simple to create classic boids in tp - you would have much more control through curves to when attract, repel particles. Worth a try anyway) Last edited by 3ak : 04 April 2013 at 09:14 PM. share quote
 04 April 2013 #3 mstarktv Frequenter   portfolio Michael Stark FX artist Pixomondo USA   Join Date: Dec 2012 Posts: 100 I'll give this a try tomorrow when I get some free time. I tried earlier in the week to implement it quickly in TP but was running into problems. What's funny is that the probleMs I had in TP I didn't have in Pflow and vice versa. In TP I just did a distance condition and then applied a force. Looking back ill probably give it a try and do a cross with the direction of the normal. The problem I had in TP though, was following the average position, and keeping particle apart - basically a keep apart. I may be overcomplicating it though...probably. share quote
 04 April 2013 #4 CGTalk Moderation Expert   Join Date: Sep 2003 Posts: 1,066,473 Thread automatically closed This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum. __________________ CGTalk Policy/Legalities Note that as CGTalk Members, you agree to the terms and conditions of using this website. share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.