Space Engineers
Недостатньо оцінок
Gravity Steering (Grid Torque Provider)
   
Нагородити
До улюбленого
В улюблених
Прибрати
Розмір файлу
Додано
Оновлено
400.976 KB
6 квіт. 2021 о 5:45
12 серп. 2021 о 2:23

Підпишіться, аби завантажити
Gravity Steering (Grid Torque Provider)

Опис
The idea
This script implements an alternative "steering" approach using artificial gravity. In SE there is a possibility to apply force to a ship using artificial mass blocks and gravity generators (placed on the very same ship). This can be used to create torque, i.e. rotate a grid (when point where force is applied ends up outside center of mass). Example of gravgens/artmasses outside of CoM generating clock-wise torque (the farther from center, the bigger the impact is):
______
| ^
|GG x GG
|____v

Usage
  1. Paste the code
  2. Make sure you have needed blocks - cockpit, remote, gyro (orientation matters, gyro should point with its' small panel forward).
  3. All mentioned blocks must be in one group, including programmable block
  4. Place gravgen+artmass "clusters", add all blocks to the same group as above

Hints
Remember that gravgen applies its' force to superposition point of all artificial mass blocks, ideally you want to have this point as close to the center of mass axis as possible. The farther the cluster is from the CoM, the more efficient it gets.
To get good Yaw/Pitch control, place clusters on the middle line of your ship, front and back, as far as possible from the center.
For Roll, you want to place them left and right (or up and down) from your center of mass.
The gyro that you add to group acts as a reference to CoM point, it's important to place it close to actual center of mass.

The script has good performance, idling (no user mouse moves, etc) at ~0.015ms, going up to 0.1m/s during extensive large grid steering with 100s of gravgens. Performance is linearly dependent on number of gravgens.

Delta Steering integration
To use with Delta Steering script (recommended) just name the gyro the same as that script requires ("forward-gyro"). If this name is detected, then Grid Torque Provider would listen to gyro override changes done by DS.
Коментарів: 12
cheerkin  [автор] 12 серп. 2021 о 2:26 
Добавил проверку, включен ли оверрайд на гироскопе - если нет, то игнорим его. Теперь после вырубания DS скрипт гасит остаточное вращение и засыпает.
cheerkin  [автор] 8 серп. 2021 о 14:18 
Круто, рад, что разобрался. Меня не было на выходных, завтра гляну чё там как.
Super Carrot 7 серп. 2021 о 12:55 
Вывел кластеры GS чтобы не пересекались с другими полями и само собой разрешилось :emofdr:
Ну и если резко отключать DS, маленькая тяга остаётся.
Super Carrot 7 серп. 2021 о 9:45 
Похоже, что проблема характерна для определенных чертежей, на других кораблях всё отлично работает. Буду разбираться.
cheerkin  [автор] 7 серп. 2021 о 7:08 
Сейчас некогда, позже проверю, может обновой что-то поломалось. Должно работать, если параметры скрипта не менялись явным образом.
cheerkin  [автор] 7 серп. 2021 о 6:53 
Да, есть условие выключения масс, оказывается.

if (generatingTorque && Variables.Get<bool>("idle-shutdown"))
// меняем состояние

Состояние меняется, если выставлена переменная idle-shutdown (true изначально) и по наличию control torque, отличного от нуля.
Переменную можно выставить в кастом дате так: command:set-value:<name>:<value>, либо выполнив аргументом на пблоке.
control torque - это вектор, представляющего вращение мышкой.
Super Carrot 7 серп. 2021 о 6:44 
Просто массы конфликтуют с перекрывающими полями, возможно сделать toggle на отключение? Я не нашёл аргумента в коде
Super Carrot 7 серп. 2021 о 6:43 
Немного перефразирую, в idle при каком условии переходи скрипт?
У меня Torque выставился на 1 и не меняет состояние
cheerkin  [автор] 7 серп. 2021 о 6:42 
Насколько помню, не должны отключаться вообще, из соображений производительности. Включение-выключение масс и гравгенов сравнительно дорого.
Super Carrot 7 серп. 2021 о 6:23 
А массы при каком условии отключаются?