Rotation via JS

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Rotation via JS

Post 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
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Is your asteroid using dumbAI? If you’re using a custom AI, the ENTER handler of your GLOBAL state should contain performTumble.
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post by Ark »

Actually my asteroid is your shady billboard :lol: and until recently it also had some boulders inside :wink:

Thanks Ahruman!!! (again)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Rotation via JS

Post 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.
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Re: Rotation via JS

Post 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 :?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Rotation via JS

Post 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.
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post 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
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post 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.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post 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 :)
Bounty Scanner
Number 935
Post Reply