Good afternoon everybody!
I am currently trying to implement a scripted "button".
Basically just an activator (custom mesh) that has a script attached to it that "pushes the button in" when the player activates it.
So I need to move an object reference "backwards" from where it is.
If the object is placed on a straight wall then that is simple: Just move it on the X or Y axis.
But I need to have this button on a sloped wall (for reasons), that wall is also placed at an angle in terms of the Z axis.
So I need to move an object reference along its local X Y or Z axis.
Kind of like you can do in the CK, but I need to do it with a script.
So a function like this would be cool:
MoveOnLocalAxis(float LocalXMovement, float LocalYMovement, float LocalZMovement)
But there is not function that does something like that, not even F4SE can do something like that.
(I already emailed the F4SE team and asked them if they could maybe implement a function like that)
So I need to make a script that does the following:
- Get the current position of the object
- Do some fancy math to figure out the new position
- Translate the object to that new position
Except it isn't.
To get the "direction" of the local X Y or Z axis I need to know how the game actually handles or represents the "rotation" of an object.
If you edit an object reference in the CK then you have three values (X Y Z rotation) but what do they actually mean?
Sure if you just rotate along one axis everything is easy.
But if I tell the game to rotate something to 36° X, 57° Y and 11° Z, how does the game actually handle that?
Does it rotate along the Z axis first, then the Y axis, then the X axis?
Does that even matter?
I really hope that somebody with more knowledge about all of this stuff can help me becaue there is no documentation on how exactly this works, so I am really stuck.