panda3d-docs
panda3d-docs copied to clipboard
Better documentation of lookAt and headsUp
Description
In the documentation, the lookAt and headsUp functions (and their various overloads) could use some more explanation, I think.
Here are some questions I had that the Docs dont't answer, in my opinion:
- What's the difference between
NodePath.lookAt( point, up )andNodepath.headsUp( point, up )? - What space are the point and the up vector in?
- How does this change when adding the other argument? (I found out the hard way that up stays in the node path's parent's space)
For the record, documentation of heads-up:
Given two vectors defining a forward direction and an up vector, constructs the matrix that rotates things from the defined coordinate system to y-forward and z-up. The up vector will be rotated to z-up first, then the forward vector will be rotated as nearly to y-forward as possible. This will only have a different effect from look_at() if the forward and up vectors are not perpendicular.
Documentation of look-at:
Given two vectors defining a forward direction and an up vector, constructs the matrix that rotates things from the defined coordinate system to y-forward and z-up. The forward vector will be rotated to y-forward first, then the up vector will be rotated as nearly to z-up as possible. This will only have a different effect from heads_up() if the forward and up vectors are not perpendicular.
So, one will prefer aligning the object with the Y axis, the other will prefer aligning it with the Z axis.
The other argument works like it does in other NodePath operations: it indicates which space the other parameters are relative to, the default being the NodePath's own parent.
I am not sure where exactly in the manual this information would fit, did you have a suggestion?