LookAtConstraint rotation affected by worldUpObject's position and not rotation?

Hi there,

I've assigned a transform to the worldUpObject field of a LookAtConstraint component as shown below:
7742043--973200--upload_2021-12-16_18-18-44.png

Why is it that changing the position of the worldUpObject in relation to the object on which this constraint is attached, affects its rotation? Should it not just depend on the rotation of the worldUpObject? Rotating the worldUpObject actually doesn't seem to affect the rotation at all, so am I misunderstanding something?

I originally posted this question in the animation sub-forum .

Thanks,
Daniel

Hi, I am working on something similar to this and noticed a 'cross affective' on two gameobjects instead of just one. I just narrowed down the test to clarify. I have the parent object rotation being effected by the child rotation. I am hoping its a coding mistake on my part and then your post popped up.
Forgive me I am not trying to highjack. This post came at the correct time for my efforts. I am curious as to what you find out based upon your description. I have 12 years of Unity so when these oddball scenarios pop up I follow closely.

Bump

[quote=“daniel_lochner”, post:1, topic: 867962]
Why is it that changing the position of the worldUpObject in relation to the object on which this constraint is attached, affects its rotation? Should it not just depend on the rotation of the worldUpObject? Rotating the worldUpObject actually doesn’t seem to affect the rotation at all, so am I misunderstanding something?
[/quote]

I would be careful when using a Look At Constraint in an Animation Rigging setup. Look At Constraint is a native Unity constraint is evaluated after animation has finished. In comparison, the Animation Rigging constraints are animation playable driven constraints and are evaluated by the Animator directly. Depending on your workflow, you might want to use one or the other, but mix & matching may cause issues.

https://docs.unity3d.com/2022.2/Documentation/Manual/Constraints.html

The best equivalent in Animation Rigging right now would be MultiAimConstraint.

Otherwise, reading from the LookAtConstraint documentation, the worldUpObject is used to calculate the up vector for the constraint. So, it’s going to take the direction from the game object to the world up object. Rotating the world up object won’t do anything.

https://docs.unity3d.com/2022.2/Documentation/Manual/class-LookAtConstraint.html

Ah interesting. Thanks @simonbz ! Never knew that LookAtConstraint wasn't apart of the Animation Rigging package -- because of the similar naming convention. Will have to look into the MultiAimConstraint. On an aside note: Is there any way we can access the implementation of the LookAtConstaint? I just need really simple LookAt functionality, however, whatever I try, using the built-in LookAt function achieves undesirable results for game objects with scaling and different offset rotations etc. Would really appreciate it! :)

[quote=“daniel_lochner”, post:5, topic: 867962]
Is there any way we can access the implementation of the LookAtConstaint?
[/quote]

Unfortunately, that is not possible. While the Animation Rigging source code is available, the LookAtConstraint is a native constraint in Unity core and I can’t legally share that source code.

However, it appears that LookAtConstraint and AimConstraint share the same implementation. The difference being that LookAtConstraint is a simplified constraint with fewer parameters.

The MultiAimConstraint has a similar implementation. So I think it’s a fair point of comparison.