Browse Search Popular Register Upload Rules User list Login:
FAT: Water drops counter

screenshot of the scene

Author: JakubKubo

Group: Educational

Filesize: 42.81 kB

Date added: 2018-10-20

Rating: 5

Downloads: 355

Views: 104

Comments: 7

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0


Scene tag

For Advanced Thymers only (I´m looking at you s_noonan, X-ray, Kilinich, FRA32)

Simple task:
- Count the water particles by script then delete them
- Minimal code

- Not sure why it get ~46% of particles, higher frequency gets even WORSE results
- Anything above 280Hz wil stop working (as many of my scripts, don´t know why)

How to solve this? This is small task, but my scenes like "air refueling" and "concrete"
use those, to store water particles in tank as number in variabile (for CPU reasons)
Last edited at 2018/10/20 19:41:17 by JakubKubo
Please log in to rate this scene
Similar scenes
Title: Rocket car
Rating: 7.5
Filesize: 164.46 kB
Downloads: 564
Comments: 3
Ratings: 2
Date added: 2008/09/29 08:26:13
Made with: Phun
Rating: rated 7.5
Title: improved penny counter
Rating: 7.3
Filesize: 148.8 kB
Downloads: 518
Comments: 2
Ratings: 10
Date added: 2009/01/10 17:54:16
Made with: Phun
Rating: rated 7.3
Title: Water Counter
Rating: 6.1111
Filesize: 18.83 kB
Downloads: 605
Comments: 0
Ratings: 3
Date added: 2018/10/21 17:17:30
Made with: Algodoo v2.1.0
Rating: rated 6.1
Title: night car mission 3 - underground
Rating: 5
Filesize: 112.18 kB
Downloads: 543
Comments: 0
Ratings: 1
Date added: 2009/06/29 22:21:20
Made with: Phun
Rating: rated 5
Title: ternary counter numbered
Rating: 5
Filesize: 21.7 kB
Downloads: 250
Comments: 5
Ratings: 1
Date added: 2015/06/08 22:54:01
Made with: Algodoo v2.1.0
Rating: rated 5
Title: the snow
Rating: 5
Filesize: 127.75 kB
Downloads: 257
Comments: 0
Ratings: 1
Date added: 2008/10/13 08:00:51
Made with: Phun
Rating: rated 5
Responses to this scene
show list
Title: Water Counter
Rating: 6.1111
Filesize: 18.83 kB
Downloads: 605
Comments: 0
Ratings: 3
Date added: 2018/10/21 17:17:30
Made with: Algodoo v2.1.0
Rating: rated 6.1
May I ask,how much did it took you to write the "OnClick" code on the "Spawn 100 drops water" box?
writing that code is actually quite simple. all you need to do is make te water in the scene, select it, copy it, paste it inside the script(thus turning it into its text form) and trimming off the beginning that describes the copy. I am actually positively impressed you knew about that Jakub c:

About the counting issue:
Unfortunally, water particles do not register in events, meaning that there is no "e.other" describing the particle, thus making direct interactions impossible. The idea of using the killer attribute is appliable, but it doesn't behave properly when multiple collisions happen at once, which is what causes it to count too little. what DOES work however is using an alternative way of killing the water, one of which is very simple:

Remove all the killer stuff from the box and just make its adhesion -1e+010

The negative adhesion causes ridiculous collision behavior, and the extreme magnitude causes any water touching the box to be immediatly launched into oblivion, where we dont have to care about it anymore!

PS: Why am I not mentioned as advanced thymer:'(
You are impressed that I know how to copy-paste? Thanks :lol:
Exactly, copy-paste and NotePad is your friend!

I knew I forget someone!)|( You will be added to FAT list immediately!
Sorry for your inconvenience and stay FAT!:tup:

Yeah but if you are NOT using killer planes, then water is still calculating, thus CPU consuming, but can try that!
I was thinking about spawning circles with timeToLive:=1/sim.frequency; that delete just ONE water drop at time and counting that...But not too sure about how heavy it will be or CPU

- About that? That whole scene is just OCEAN of text? Yeah I know that and I´m using that when making long scripts, copy script to notepad, edit, paste back
Actually parts of codes are in several .txt files on my desktop:D
- First is for short common scripts as: For n , keys.isDown and description etc.
- Second with hinge and it usage: from motors, stretched axles, to "way how to trasmit data between two objects" (yeah, that is what hinge mean to me:D )
- Then few with longer script that are just pasted into object console, like piston for. ex, just open Fixate script menu, ctrl+v that file and you have working piston! Same with bombs with effects, homing rockets, etc.
- Or use phunlets to store code, for ex. I want quickly add X Y Z Q as variabiles so load phunlet with timeToLive=0
(It is like meseecs, just tool that die/despawn when finished)
or If I want readables from hinge, I will search for my 100T scale (black box that measure weight by hinge attached to background), and use that part of code from that, same for water spawner etc.
Simply I have HUGE folder named "AlgodooTools" that have all sort of textures, 3-rd party tools for algodoo or enginering, some vector programs to draw textures etc....Yeah it have few GB totally :bonk:
1. Use blue circles. Delete using scene.removeEntity(e.other).
2. If you get 47% particles, the divide count by 0.47 or increment counter by 2.128.
3. Use a funnel and water wheel to slow down the water.
4. Use air friction to slow down the water.
5. Change the water pattern for better counting.
6. Reset Algodoo since higher sim.frequency improves water counting for me in this scene.
7. Use multiple water counters and add them up.
8. Count water when you make it. Erase all water some time later or at fixed intervals.
Last edited at 2018/10/21 09:51:49 by s_noonan
I think you are programmer so you know my goal: One script (to rule them all :lol: ) that work at perfectly at any input any Hz, do not change rest of scene

1. Use circles as liquid particles? Is that less CPU demanding? Because sometimes you need A LOT of water
2. Yeah, I was thinking about it, but it is not reliable
3. But what about if you want high volume transfer?
4. Well, that would change EVERYTHING else in scene, keep in mind that this scene is just part of code that is used in other scenes, so it need to be independent as much as it can be
5. In real use pattern will be totally random, so i cannot help it by giving it easy-to-count pattern, it need to work with any input
6. I was meaning very high frequencies, so high it was lagging NTB
6.1 Algodoo was installed and restarted recently to this NTB, I´m not at home for like...end of my study abroad
7. Same thing as in 3 note, it need to be universal simple and work at any circumstances (angle, volume, pattern etc.)
8. What? How did it help me to count particles that touched counter?

Idea with custom particles seems promising most, some onDie event and it should be working perfectly....
Why is it important to count the water just before you kill it? Are you trying to determine how much water is in the scene at any one time? In that case you can use sim.particleCount. Also, number of particles killed = Number of particles made - sim.particleCount.
No, I want to count how many particles touch surface of object, for refueling:
Pipe will spawn water, water will flow to car and car tank will destroy water and count it > that way particles are saved as number, so I don´t need to store particles in car tank, which is CPU heavy, and also leaking because of water physics
If you spill some water, then, nothing go into tank to touch object (so counter is still)
Thanks for the script will try that later...