Conditional and Dependent Properties

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

Conditional and Dependent Properties

Postby millertime88 » Fri Jun 10, 2016 8:34 am

Sorry of the subject is vague, but I am looking to use Algodoo to visually aid aviation meteorology students to better understand air and the atmosphere (which pretty much acts like a liquid) - but I had some ideas and one of which was changing properties based on the changing of other properties of that object.

For example, we can easily setup restitution and increase or decrease energy of bouncing balls (plenty of examples online) showing the ideal gas law. However, is there a way I could for example, change the color of an object based on its changing restitution? Is there a way I could increase or decrease its gravity to simulate that hot air rises and cold air displaces hot air? Is there a way I could show the eventual equilibrium of a cold air mass of particles converging with a hot air mass of particles and eventually evening their temperatures out to an average - all while changing the color gradually to demonstrate the temperature? (Red for hot and Blue for cold and a gradient for all the in-between temperatures)

I struggled finding anything in the forums, but if you know of something or have any advice please provide a link or let me know!

Thanks!
millertime88
 
Posts: 3
Joined: Fri Jun 10, 2016 8:10 am

Re: Conditional and Dependent Properties

Postby icrls984 » Sun Jun 19, 2016 2:55 am

You can set up the color to reflect its restitution using scripts. Go to the script menu in the object.
Personally, I would use the colorHSVA, and I would also recommend replacing the hue with restitution. The rest you can set with other values, such as 1. Alternatively you can use color, which is in RGB.
Code: Select all
colorHSVA = {
    [Hue, Saturation, Value, Alpha]
}

What do you mean by gravity? I'm not sure what you mean. :?
I think a good way to show the evening out of temperatures is taking the velocity of the particles and using that in the colorHSVA.
Code: Select all
colorHSVA = {
    [math.vec.len(vel) + 240.0, 1.0, 1.0, 1.0]
}

The curly brackets are to make the color refresh every frame.
I also added 240 to make it blue, because you wanted blue to be cold.


I'm pretty bad at physics and scripting myself, but I hope this helped! :)
.
User avatar
icrls984
 
Posts: 80
Joined: Thu Jun 13, 2013 6:33 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron