Am I doing something stupid?

Hi all!

I’ve been making a camera to track to a certain object. No big problem, simple Python. But for some reason the camera is screwed up and I cannot fathom why its behaving this way. I even cut and pasted some code to see if its just me.

I have slowed the cameras rotation to show how it (the camera) points in the opposite direction of whatever I want to track…

I thought it might be cured by magic CTRL A, then I tried animation hacks but I get nothing.

Can someone save my sanity? A straight-jacket is looking very comfy right now…:spin:




Track.blend (354 KB)

It does track opposite, but I’m not sure if that’s a bug, or if that’s correct. Just changing the 9th line to

vector = -own.getVectTo(sphere)[1] #Y_Vector

seems to fix it.

Cool, insanity averted! The funny thing is all my blends do this…odd. But hey, thanks!

Yo Rubbernuke,

Yeah like SL said, because the default camera views along it’s negative Z axis.

BUT…! I was confused for a second (because I’m a bit rusty) by your comment, “Y_Vector”. Tuple[1] returns the vector not the Y vector. Tuple[0] returns the distance.

vector = own.getVectTo(sphere)[1]
distance = own.getVectTo(sphere)[0]

Also, slight nit pick. The vector “vector” is in fact the vector from the camera to the sphere. I wouldn’t apply the negative until it comes time to point the camera.

own.alignAxisToVect(-vector, 2, 0.01)

Thanks for explaining that, Equip.

@Rubbernuke - I’d personally negate the vector when it comes to aligning the axis, like Equip said, as well.

Hey, nice to see you again Equip- long time no see! And thanks for clearing that up. Out of interest, why does the camera always default to -z? It would make more sense if it defaulted to +y so all objects point in a unified direction on creation.

But I am now sane thanks to you and Solarlune. I will now cancel my room at Arkham!



I think the default setup of blender is a top down view, like a graphic artist would use if laying out objects on a table to photograph from directly above.

We might have a thing about the Y axis because “y” is often the value we’re solving for and because it’s graphically represented as vertical on a page. And because we walk around “upright” on what we think of as an XY plane.

So given these two things it follows that the camera is plonked as it is, and like any other object it is created at the origin (or cursor) with it’s local axes aligned to the world axes. So then the most “important” axis of a blender camera becomes it’s local Z axis and that it will be looking in the negative direction.

Just remember that getVectTo returns two tuples, one is distance the other is vector. The vector quantity will return three tuples if you ask it. If you ask for [1] it will not return a vector, it will return a displacement along the y axis.

Yo, I’m good. Playing too much Minecraft and witnessing the horror of Australian federal politics. Yeah, stay away from the shrinks, hang out instead with the good folks at blenderartists.