Teardown-Issue-Tracker-Maintainers / Teardown-Issue-Tracker

A public repo for the community to track issues/bugs/feature requests in Teardown.
12 stars 6 forks source link

[Bug/Feature] Tool no longer moves with the camera when in first person in certain cases. #593

Open alekseiM88 opened 1 month ago

alekseiM88 commented 1 month ago

Describe the bug

On the stable branch (1.5.4) the functions AttachCameraTo and SetCameraOffsetTransform modify the placement of the player's held tool as well as the camera. This is not the case on the experimental branch (1.6.0). While I think this may have been on purpose, the changes do break something I was working on, so here I am.

Steps to reproduce the behavior

  1. Make a global mod and put this in its main file:
    function tick(dt)   
    -- Tools will remain with the camera in 1.5.4 (what is wanted),   
    -- and they will remain with the player's body in 1.6.0 (what is not wanted).    
    --AttachCameraTo(GetWorldBody())   
    SetCameraOffsetTransform(Transform(Vec(0, 0, 4)), true)   
    end  
  2. Enable the mod and load a map on the stable branch.
  3. Do the same on the experimental branch.

Expected behavior

I'd expect the tool to move with camera, but it doesn't on the experimental branch. Note that while SetCameraOffsetTransform doesn't change the tool's position, SetPlayerCameraOffsetTransform does. I'm guessing this is on purpose, however I wouldn't be able to use it for my project as I still use AttachCameraTo to stop the player's automatic height adjustment from messing with the camera. See below for what might be a better solution.

Environment

Additional context

Possible alternative/better solution:

A SetPlayerHeight function in the API to forcefully set the player's height for that frame. It would allow me to work around the issue in my specific use case, while also still making sense and being useful to other people.

Here are also some videos I recorded to better demonstrate the behaviour I've been experiencing.

Stable Branch: https://github.com/Teardown-Issue-Tracker-Maintainers/Teardown-Issue-Tracker/assets/136792894/52bf47dd-8b6e-423c-a7e6-cda1e521e6c2

Experimental Branch: https://github.com/Teardown-Issue-Tracker-Maintainers/Teardown-Issue-Tracker/assets/136792894/c02a60cb-42c8-4e27-8a2b-067f2c907d2b

Gregory-Gregory commented 1 month ago

@alekseiM88 hi!

Thank you for reporting this. I have forwarded the information to the QA team and will let you know if they have any updates regarding this.