Camera in the POV of a 3D boid

Hi There,

I currently have a bunch of 3D boids flying in an environment. See it on glitch: . I’m trying to make it so you can look through the POV of any particular boid. I’m unsure about what strategy to use. Do I do as I’ve done here, and try to pull a follow camera tight in? Or should I use a universal camera and position it at the meshe’s position and make it match the orientation of the boid. If so, is there example code I could look at for this? My code is here: Glitch :・゚✧

It’s a little hard for me to tell exactly what my follow camera is doing at the moment, if it has the correct orientation, etc. Some debug ideas about that would be cool too.

also press spacebar and you can shift POV, just not sure if I’m seeing through one’s eyes, or above or something

I think I’m either looking at the sky or the ground, so I think I need to change my camera angle by 90 degrees.

Or maybe what about creating a camera and making it child of the boid you want to track?

hi there!,

I’m pretty new to babylonjs, could you point me towards how making an object a child of another object works (I think that’s pretty basic, but I don’t have a solid grasp of that; should I do the beginner tutorials again? I don’t recall that being discovered there however). Also, take a peek at this implementation, it looks neat (from far away):

Also, I would have to think through the orientation of that camera, I’m imagining, probably the local orientation vis-a-vis the mesh, correct?

So, parenting worked. I gave a camera to every boid. And, it appears to be, fundamentally working. When I use the inspector, while clicking one of the boid cameras, I see that it says, “TRANSFORMS: X 1.00, Y 1.00, Z 0.00”; so, I think that I have to correct that and get it to be 0,0,0, but maybe this is the initial setting so that the camera is not “stuck inside” the object; so, I guess I have to think about this. It’s awesome that the camera is correctly oriented though, looking through the eyes of the boid.

Never mind figured it all out! Case closed!

1 Like