Read informations from an other geometry

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

Read informations from an other geometry

Postby francky380a380 » Wed Jun 27, 2018 7:42 pm

Hi,

Simple question; I would like to "read" informations from a geometry "glue" to another one without using "Oncollide" [I already tried and it doesn't do what I want it to do]

The situation: I'm working on a flying drone and I want it to "grab" stuff.
I have a cube which is the "hook". I use ".adhesion" to grab stuff but I need the thruster to take care of the load's mass to.
So when the hook stick to the load, I would like it to "read" the mass of the load to put it in a variable: scene.my.carry. But I don't how how to "read" the size, density, etc.

I tried with e.other.XXXX but doesn't work. "Oncollide" is to fast and doesn't allow the hook to grab correctly the load and the drone just fly up !

Thank you !
francky380a380
 
Posts: 48
Joined: Tue Dec 17, 2013 8:12 pm

Re: Read informations from an other geometry

Postby FRA32 » Sun Aug 05, 2018 1:53 pm

Adhesion is a creative but risky way of grabbing objects, as it has a tendency to drop whatever is carried, and once that thing detaches, theres no getting it back. You could use attraction instead, as it has a greater range than just surface-to-surface interaction. You would basically add a small magnet cube to your hook, and when the hook makes contact with something, use onCollide to read the mass of the object, and the magnet adjusts its attraction accordingly to the registered mass using poststep. You could disable it by resetting the mass to 0 then.
FRA32
 
Posts: 229
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests