Animating a 3D Gauge

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Message
Author
User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Animating a 3D Gauge

#11 Post by Keith Baxter »

Ralph wrote: Wed Oct 14, 2020 11:06 am We had a similar question a while ago, from a company. The part where it gets tricky is when the sphere is going to rotate in all directions, and things project on the sphere need to move in the correct direction and change size if they move away or come closer, and they need to rotate in the correct direction as well. If you put a lot of time into it, it might be possible, but it'll be a struggle.
Ralph,
I agree. not easy and is going to require some engineering and math. Our good friend Tony loves challenges. Perhaps he has done it on the quiet already. :roll: :lol: :lol:
Here is the basic math. All can play with it and find a solution to share with others.

Code: Select all

1) To determine the radius of a of a sphere slice we use <r1 = r*math.cos(degrees)>
2) To determine the y coordinate position we use  <y = r*math.sine(degrees)>
3) To determine the x coordinate position we use <x = r*math.cos(degrees)>
4) lua works in radians so to convert degrees to radians we use <degrees*math.pi/180> to get radians.
5) Use for loops to draw the lines, polygons and place text.
6) Use rotate to move the entire canvas clock wise or counter clockwise foR x,y simulation.
The zoom and sizing I have not played around with yet. But there are many math tutorials on the net that go through x,y,z sterographic projection.

Anyway, the pebble has been thrown into the pond. Lets see the ripples.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Ralph
Posts: 7924
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Animating a 3D Gauge

#12 Post by Ralph »

The goal was this:
Image

In my opinion it isn't possible, but if you want, go ahead :)

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Animating a 3D Gauge

#13 Post by Keith Baxter »

Hi Ralph,

:o :o an "Apollo Flight Director Attitude Indicator" ? Or an old school FDAI
The math I provided i think can do that.

To tilt the sphere Z axis we will most probably have to use math.tan(). The hints are plentiful for others to run with. I am excited.

Let me finish the project I am busy with then the zibo overhead, then I will attack that one. I am also busy. LOL :lol: :lol:
Ok i will let it jump the queue in front of the overhead. So maybe later this week if Tony or anyone else does not beat me to it.

Those old school gauges were run on a gyro i think. I have a vague recollection of repairing one on the KR2 I was building in the mid 1970's . Think it all went back together and was passed by the EEA


Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
BradyBrother100
Posts: 54
Joined: Tue Oct 13, 2020 4:21 pm
Location: United States MDT

Re: Animating a 3D Gauge

#14 Post by BradyBrother100 »

Hey Keith!
Thanks for the visualization! Instead of rotating the sphere left and right, would there be a way to rotate the sphere up and down? I really appreciate all of the support!


Thanks!
Brady

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Animating a 3D Gauge

#15 Post by Keith Baxter »

Hi Brady,

Yes we can rotate the sphere on its latitude axis and on its longitude axis.

We can also tilt both axis clock and counter clock wise by rotating the canvas. As I said I have not tried tilting the axis forward and back. I will look into that later if it is necessary

As I said. I will do a concept code with a few latitude and longitude lines. You guys can take the concept and enhance. But that will only be late tomorrow or Friday. Maybe. I am GMT + 2

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Animating a 3D Gauge

#16 Post by Keith Baxter »

Hi

Xmas is early this year. :mrgreen:



Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
jph
Posts: 2856
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Animating a 3D Gauge

#17 Post by jph »

Keith Baxter wrote: Wed Oct 14, 2020 12:21 pm Hi Ralph,

:o :o an "Apollo Flight Director Attitude Indicator" ? Or an old school FDAI

Keith
Morning Keith, looks like an AH from a Phantom F4.. would love to have a real one :)
Joe
Joe. CISSP, MSc.

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Animating a 3D Gauge

#18 Post by Keith Baxter »

Hi Brady,


For what you want to do this should assist. It will give you something to play around with.

The lines are in the .json file. Yon can add, remove, shorten etc.

For others, I will look into rotating the other axis sometime over the weekend. But you are welcome to mess around with it and come up with your own version.
Some might prefer to draw lines using for loops. I used a .json file for simplicity.

Note this also works if you apply polygons. so you can draw shapes like stars, circles, moons, triangles, in fact almost anything .
use the same concept to add text. Remember to rotate the text.
Enjoy, I hope we see a lot of innovation pop up from this.
Test_Altitude Indicator concept.siff
(8.95 KiB) Downloaded 173 times
Keith

PS the red and blue squares are the movement dials.
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply