Page 1 of 1

Rotation via JS

Posted: Sun Jan 25, 2009 2:32 pm
by Ark
Right now i working in a strange kind of asteroid. What i want is this asteroid to be placed in the system with both the populator and via a script. Ihave noticed that when it placed through a script it does not ratate but when the populator add it then it rotates. How i can force it to rotate when it is placed with a script

Posted: Sun Jan 25, 2009 4:08 pm
by JensAyton
Is your asteroid using dumbAI? If you’re using a custom AI, the ENTER handler of your GLOBAL state should contain performTumble.

Posted: Sun Jan 25, 2009 4:11 pm
by Ark
Actually my asteroid is your shady billboard :lol: and until recently it also had some boulders inside :wink:

Thanks Ahruman!!! (again)

Re: Rotation via JS

Posted: Sun Jan 25, 2009 4:20 pm
by Eric Walch
Ark wrote:
Right now i working in a strange kind of asteroid. What i want is this asteroid to be placed in the system with both the populator and via a script. Ihave noticed that when it placed through a script it does not ratate but when the populator add it then it rotates. How i can force it to rotate when it is placed with a script
It should just work. Probably you didn't give it a dumbAI.plist? That starts with a performTumble and does the rotation. It rotates over two axes with speeds defined in shipdata as: pitch & roll.

Re: Rotation via JS

Posted: Sun Jan 25, 2009 4:24 pm
by Ark
Eric Walch wrote:
Ark wrote:
Right now i working in a strange kind of asteroid. What i want is this asteroid to be placed in the system with both the populator and via a script. Ihave noticed that when it placed through a script it does not ratate but when the populator add it then it rotates. How i can force it to rotate when it is placed with a script
It should just work. Probably you didn't give it a dumbAI.plist? That starts with a performTumble and does the rotation. It rotates over two axes with speeds defined in shipdata as: pitch & roll.
It uses the nullAI.plist. Strange that when it is added by the populator it rotates and when by the script it does not. I had some very difficult time until I finally understood why some asteroid billboards rotate and some others not. Maybe it has to do with the role. When it is added by the populator it has the role of asteroid , when by the script the role of asteroid billboard :?

Re: Rotation via JS

Posted: Sun Jan 25, 2009 4:32 pm
by JensAyton
Eric Walch wrote:
It should just work. Probably you didn't give it a dumbAI.plist? That starts with a performTumble and does the rotation. It rotates over two axes with speeds defined in shipdata as: pitch & roll.
It’s actually not possible to rotate around more than one axis at a time in 3D.

To be clear, performTumble sets pitch and roll to random values within the range defined by max_flight_pitch and max_flight_roll, then switches to the BEHAVIOUR_TUMBLE AI behaviour (which simply applies the current pitch and roll values without paying attention to anything going on around the ship).

Eric mentioned elsewhere that it’s not possible to set a specific constant rotation. This should be quite easy to implement as a JS command. It could be done as an AI command too, but the problem there is that you can’t use any sort of calculated value for the parameters.

Posted: Sun Jan 25, 2009 4:50 pm
by Ark
Actually I do not want something that complicated. I just want the asteroid billboards to not be completely immobile.

By replacing the AI everything works fine now but I am still not sure why the ones added by the populator did rotate even with nullAI.plist that does not contain the command perform Tumble. Since I finally got what I wanted I think I will leave the explanation for the above to someone with a far better understanding of oolite mechanism that me :wink:

Thanks again !! :D

Posted: Sun Jan 25, 2009 4:54 pm
by Thargoid
Asteroids auto_AI to dumbAI.plist, which has performTumble as it's global ENTER state.

The ones added by the populator therefore switch over to dumbAI.plist, but the other ones don't. Hence the difference.

Posted: Sun Jan 25, 2009 6:03 pm
by Frame
Just a side note, if you set its shipdata pitch or roll to 0 it will not rotate at all... happend to me with the jump gates :)