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

BSFurnitureMarkerNode markers display as rotated in the wrong direction #239

Open
Sync-67 opened this issue Nov 29, 2023 · 7 comments
Open

Comments

@Sync-67
Copy link

Sync-67 commented Nov 29, 2023

When working with a BSFurnitureMarkerNode, if the heading value is not equal to n * Pi, where n is an integer, the marker will be rendered as rotated in the opposite direction of the heading value.

It seems the game expects a positive heading value to refer to a clockwise rotation around the Z axis, while a negative heading value is a counterclockwise rotation around the Z axis.

The opposite is true in NifSkope. Positive heading values result in counterclockwise rotations and negative heading values result in clockwise rotations.

For example:

  • A heading value of zero will display the marker correctly because no rotation occurred.

  • A heading value of Pi will also display correctly because rotation 180° will result in an object facing the same direction, whether it was rotated clockwise or counterclockwise.

  • A heading value of 2 Pi will display correctly because rotation 360° also gives the same result, regardless of rotation direction.

  • A heading value of 0.5 Pi will display incorrectly because NifSkope rotates the marker counterclockwise 90°, while the game interprets it as a rotation 90° clockwise.

  • A heading value of -0.25 Pi will display incorrectly because NifSkope rotates the marker clockwise 45°, while the game interprets it as a rotation 45° counterclockwise.

This can be seen with the attached files. In Nifskope, the markers will look to have the wrong heading values (where not equal to 0 or Pi), but in the Creation Kit the markers will appear correct, and in game the character will sit/lay in the direction indicated in the Creation Kit. With the included plugin, you can use the command "coc aaafurnituretestcell" to teleport to a test cell with the example furniture.
FurnitureMarkerRotationExample.zip

To fix this, I think that in line 1723 of glnode.cpp, "heading" just has to be multiplied by -1? But I have very little knowledge about coding, so that's mostly a guess.
https://github.com/niftools/nifskope/blob/3a85ac55e65cc60abc3434cc4aaca2a5cc712eef/src/gl/glnode.cpp#L1723C18-L1723C18

Let me know if anything is unclear, or if I can provide more information.

@ghost
Copy link

ghost commented Feb 9, 2024

might just be collision issue, more info here https://forums.nexusmods.com/topic/5140400-problem-with-setting-furniture-markers/

@Sync-67
Copy link
Author

Sync-67 commented Feb 9, 2024

@nexustheru Thanks for this link. It gives me some ideas to help solve a different problem I was having.

Unfortunately, collision has no effect on the rotation of the furniture marker, which is being displayed in NifSkope incorrectly. Viewing the marker of the NIF in the Creation Kit shows the correct orientation, while viewing the same file in Nifskope shows it incorrectly (see attached screenshots). The marker heading used was -1.570796 radian, or approximately -0.5 π radian, equivalent to -90°. Collision was removed from this mesh, but the result is the same.

Changing line 1723 of glnode.cpp to
roll = heading * -1;
and recompiling from source appears to fix this issue.

Creation Kit:
FurnitureMarkerRotation_CreationKit

NifSkope Dev 7:
FurnitureMarkerRotation_NifSkopeDev7

@ghost
Copy link

ghost commented Feb 9, 2024

oh so u fixed it awsome :) god job ;)

@ghost
Copy link

ghost commented Feb 9, 2024

altho nif xml might also be altered if this happend again, if its not there it should be.

@ghost
Copy link

ghost commented Feb 9, 2024

if its not there it might be a future enhancement? ^^

@ghost
Copy link

ghost commented Feb 9, 2024

this should be closed and solved and added to nif xml, bc it should not be necessary to recompile for alignment issues. thanks to @Sync-67 , @amorilia

@ghost
Copy link

ghost commented Feb 9, 2024

@neomonkeus

fo76utils added a commit to fo76utils/nifskope that referenced this issue Jan 19, 2025
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

1 participant