CS_BeatSaber_Camera2 icon indicating copy to clipboard operation
CS_BeatSaber_Camera2 copied to clipboard

Attached camera does not behave like a child object

Open headassbtw opened this issue 11 months ago • 2 comments

When attached to a GameObject, cameras do not behave as if they are children of the target object.

So if you:

  • take a camera
  • offset it
  • attach it to an object
  • rotate that object

the camera's rotation copies the parent's rotation, instead of behaving like a child

here's an example: the middle camera is a "base" camera, with the same transforms as the problematic one, but without being attached bottom left is attached to the player/avatar (LocalPlayerGameCore) bottom right is showing that the avatar is rotated

image

side note; from what i can tell, this is more of an implementation side effect than a bug, however this is a long-standing issue i've had with this mod

headassbtw avatar Sep 13 '23 00:09 headassbtw

It doesnt behave like it is, because it isnt. The final position of a Cam2 camera is not achieved in a super straight forward fashion

The offset you configure in Cam2 is applied after the "base position" (i.e., head, attached target)

https://github.com/kinsi55/CS_BeatSaber_Camera2/blob/9b596886e45620f3b84520bad5e68274649e91cf/Behaviours/Cam.cs#L135

https://github.com/kinsi55/CS_BeatSaber_Camera2/blob/9b596886e45620f3b84520bad5e68274649e91cf/Middlewares/Smoothfollow.cs#L120-L121

https://github.com/kinsi55/CS_BeatSaber_Camera2/blob/9b596886e45620f3b84520bad5e68274649e91cf/Utils/TransformChain.cs#L6-L12

As for changing that behaviour: Thats probably not gonna happen. If you can come up with a better system that achieves all the same things as Cam2 currently does I will gladly take it, but this complicated mess is the best I could come up with.

kinsi55 avatar Sep 13 '23 00:09 kinsi55

figured

headassbtw avatar Sep 13 '23 01:09 headassbtw