Stormworks: Build and Rescue

Stormworks: Build and Rescue

46 ratings
Physics Sensor Transformer
4
2
2
   
Award
Favorite
Favorited
Unfavorite
Vehicles: Air
Tags: v1.12.2
File Size
Posted
Updated
19.782 KB
20 Feb, 2023 @ 5:28am
14 Sep, 2024 @ 4:09pm
9 Change Notes ( view )

Subscribe to download
Physics Sensor Transformer

Description
This microcontroller transforms the physics sensor's values as follows.

1. Map X
2. Map Y
3. Altitude
4. Euler angle(Bank angle, a.k.a. roll angle)
5. Euler angle(Elevation angle, a.k.a. pitch angle)
6. Euler angle(Azimuth, North:0, CW)
7. Local x linear speed(Forward +)
8. Local y linear speed(Right +)
9. Local z linear speed(Downward +)
10. Local x angular speed(Roll)
11. Local y angular speed(Pitch)
12. Local z angular speed(Yaw)
13. Abs. linear speed
14. Compass
15. Euler angle(Azimuth, East:0, CCW)
16. Tilt x
17. Tilt y
18. Tilt z
19. World X linear speed(East +)
20. World Y linear speed(North +)
21. World Z linear speed(Upward +)

Set the sensor as follows.
Blue arrow is facing front.
Red arrow is facing right.
Green arrow is facing upward.
DO NOT USE MIRRORING.

The local axis is right hand system, and local x is facing front, local y is facing right, local z is facing downward.

If you find a bug, please post a comment.
18 Comments
qbzephyr 29 Jun @ 3:35pm 
idk but i think it was written by chatgpt
May  [author] 14 Sep, 2024 @ 4:47pm 
- Next, I updated the velocity output code. This makes it easier to match positive and negative values when the output doesn't align with the coordinate system used by various users. It also reduced the number of local functions by one. This change sacrificed some reusability, but who really cares about that? Readability is far more important.

Lastly, I reorganised the entire code. I rearranged the structure and rewrote the comments to make everything clearer. Thanks to Doomer Ralsei for spotting a typo. In Japanese, the 'o' and 'a' in 'word' and 'ward' are transliterated into the same vowel, so it's hard for me to tell them apart.

Thank you for using this microcontroller for so long. I'm glad that it's been helpful for you all.
May  [author] 14 Sep, 2024 @ 4:45pm 
Hello, everyone.
I haven't updated this for a while, but as there have been a lot of updates to the game, I decided it was time to make a few changes.

You may not be too interested in this, but I've made some changes to the internal calculations. I've adjusted it to pass through the outputs of the tilt and compass sensors, which were added in physics sensor by the Stormworks development team. This change slightly reduces the number of calculations. The tilt sensor values are still output to the same channels as before, and for compatibility, I've kept the Tilt z output in channel 18. I doubt anyone is using the absolute angular velocity in channel 14, hence I replaced it with the compass sensor's value. -
epflederer 28 Oct, 2023 @ 7:11pm 
It outputs in radians. Put it through a function for -(x/pi2) to make it match the standard compass sensor
TATAKAE 19 Oct, 2023 @ 2:58pm 
I got a question about output 6. Euler angle (Azimuth, North:0, CW)
This is basically a compas, right? but what numbers does it use?
It outputs a number from 0 to something around 6.x...
Cailean.Coleman 9 Sep, 2023 @ 4:26pm 
the physics sensor was one of the best aditions to SW, change my mind.
Comrade Da 26 Jul, 2023 @ 7:05am 
I love you
W'rkncacnter 12 Jul, 2023 @ 5:21pm 
Fantastic! Thank you for this.
Olie 20 Jun, 2023 @ 11:23pm 
in the lua: "z:downword +"
lmao, its nice to know im not the only one who makes mistakes :os_niko:
Nukhind3000 3 Jun, 2023 @ 11:14pm 
You have saved my ass from having to Learn Calculus in order to use the Phys Sensor for a Gyro.
I thank you.

Mind if i Steal your code?