Artifical Horizon?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Artifical Horizon?

Postby Nxdt » Thu Mar 08, 2012 10:47 pm

I'm working on some new planes at the moment and would like to try a HUD or data readout for them.
All the simple stuff, like engine power level & gear up/down is simple, and can be done easily while still being phunlet safe. Here is the situation;

I have created a large tall & thin texture that loops around the top to make an artifical horizon scale;

I want it to take an an angle between 0, 2pi or +pi, -pi (Whatever is easier) and move the image up/down a square object and when the aircraft is level, you should only see the centreline and +/- about 60 degrees.

Here is what I have so far;
The sixth entry in the textureMatrix variable or textureMatrix(5) is the value that when changed from 0 to 1 moves the image up/down, with 0.5 positioning it "horizontal". Created a variable, "Scene.my.pitch" to store the pitch from pi/-pi. This then gets used like so;
Code: Select all
textureMatrix(5) = (scene.my.pitch + math.pi) / (2 * math.pi)


Something like a k-probe is being used to get data like angles.

But, when I try to put the code in the onlaserhit box it won't stay and will simple vanish, so I am obviously doing it wrong, How do I go about modifiying textureMatrix?
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!

Re: Artifical Horizon?

Postby Kilinich » Fri Mar 09, 2012 9:20 am

search in forum for texture transformation
viewtopic.php?f=13&t=2903&p=34142&hilit=textureMatrix#p34142
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Artifical Horizon?

Postby Nxdt » Fri Mar 09, 2012 11:05 am

Ahhh thanks, that is what I was trying to find. Luckily i've just cover matrices at uni so the maths doesn't seem too hard.

Edit, thanks again, this is what I came up with;
Rating: rated 6.5
Filesize: 142.81 kB
Comments: 6
Ratings: 5
download
User avatar
Nxdt
 
Posts: 1019
Joined: Mon Aug 31, 2009 6:32 pm
Location: Scotland!


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest