Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better documentation of lookAt and headsUp #99

Open
Germanunkol opened this issue May 1, 2021 · 1 comment
Open

Better documentation of lookAt and headsUp #99

Germanunkol opened this issue May 1, 2021 · 1 comment

Comments

@Germanunkol
Copy link

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 ) and Nodepath.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)
@rdb rdb transferred this issue from panda3d/panda3d May 1, 2021
@rdb
Copy link
Member

rdb commented Oct 26, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants