We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi! I'm using Toxiclib and I set my world bounds with
fis.setWorldBounds(new Rect(0, 0, width, height));
In this way my particles (boids style) can leave my sketch window. My question is: how to set a Force from the window sides that push particles to the window center?
I tried to search in java doc an easy way (maybe set a behaviour?) but i can't understand.. :(
Thanks so much.
Answers
Hey, something like start analyzing the behaviour of your particles might help. (what happens with those when reaching places somewhere > than width or height? or lower than 0??). Some conditional statement should do this job nicely for you. Keep also in mind this "window force" you mention could just be implicit in the behaviour of the objet itself; like a change in the vector direction. best,
When particles reach the canvas borders, they stop. Like on wall.
I didn't code the reaching border condition that you suggest, because it's automatically managed by toxic library.
My question is: toxic library has some method to set a repelling force from canvas borders, or I must code it myself?
Thanks a lot.