We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

[CG]NaejDoree • 3 years ago

Thanks for this playground ! I implemented boids for the first time easily in my unity project thanks to it o/

realtalkbean • 5 years ago

This is old but if anyone is lost on 2/5:

in Bold.prototype.steer, simply change the return statement to "return desired.subtract(this.velocity)"

"desired" is the param passed into the steer function. This param is assumed to be of type Vector. In mathematics, velocity can be represented by vectors. In other words, desired is considered a velocity in this program. This is important because if you recall in the writing above:

"steering force = desired velocity - current velocity"

desired velocity = desired (AKA the parameter being passed into steer)
current velocity = this.velocity (AKA the current boid's velocity)

Instead of implementing your own vector math function, you can use the already baked-in Vector.subtract() method.

DaBlaqSuit • 6 years ago

I have read this over and over, I still don't understand what it is that I need to do, my 2D vector either disappears or remains at the initial position while the sample moves around

Makke • 6 years ago

yeah me too! Have no idea to change what and where. any youtube explanation or step by step guide?

Ilasore • 6 years ago

Maybe this is because you actually change the velocity of your boid in your function steer.
If you do something like

this.velocity.multiplyScalar(-1);

You inverse your particle velocity at each step so it does not move.

Also if you have an error somewhere in your code you will see nothing on the viewer (or maybe your boid at the top left corner)

Jhoemar • 6 years ago

Im looking forward for Obstacle Avoidance