Not a member yet? Why not Sign up today
Create an account  

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Help with spin block angles

#1
Ive just started with some basic lua scripting with spin blocks, and im just completely lost when it comes to their angles.

If i use the following code:
I:GetSubConstructInfo(MySpinBlockId).LocalRotation

i get some weird quaterilion object with seemingly very nonsensical x,y,z and w values in. I understand that this is to represent angles in a 3 dimensional space, but i just need to get a simple angle in degrees of where the spinblock is pointing, what is the easiest way to get this?

I am completely lost, would be grateful for any help.
Reply

#2
Is there any reason you have to 'ask' what the rotation is rather than setting it yourself?
You could perhaps just use I:SetSpinBlockRotationAngle(SubConstructIdentifier, angle).
Angle being the simple value your looking for.
Reply

#3
I believe there is an old lua script somewhere here than converts quaternions to Euler

As an alternative, Unity functions should work for quaternions as well, which should have built in functionality for reading quaternions as Euler angles.
https://docs.unity3d.com/ScriptReference...rnion.html
This statement is false
Reply

#4
I solved this a while ago:
https://forum.fromthedepthsgame.com/show...?tid=11338
The code is old and needs to be updated, but everything you need is in there.
Reply

#5
(2018-10-30, 07:11 AM)Madwand Wrote: I solved this a while ago:
https://forum.fromthedepthsgame.com/show...?tid=11338
The code is old and needs to be updated, but everything you need is in there.

Oh, i actually solved it myself using some mathematical formulas from wikipedia, i didnt get an answer on the forum in the first few days, so i sorta gave up on waiting Smile
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)