Moving objects to front or back on different layers.

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

Moving objects to front or back on different layers.

Postby Xray » Sun Oct 12, 2014 8:11 am

I created a scene with three layers (0,1, & 2). I have a textured box on layer 0, and I have a colored circle on layer 1. I want the colored circle to always show in FRONT of the textured box on layer 0, but no matter what I do, the colored circle on layer 1 is always BEHIND the textured box on layer 0. I tried moving it to the front through the script menu, and I also tried moving it to the front using the mouse wheel. Neither attempt will make the circle move in front of the textured box. Any help would be much appreciated.
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Moving objects to front or back on different layers.

Postby Xray » Mon Oct 13, 2014 7:33 am

Well, so far no one has come up with any ideas except for Electronicboy who contacted me via Skype. He suggested experimenting with zDepth to see if I can get the results that I want. But unfortunately that did not work. Whenever I attempted to change the value in zDepth, it would revert back to its original value as soon as I selected the object and attempted to move it.

Well, I finally got the results I need by employing a work-around, as follows: Since the textured background geometry is currently on layer 0 (zero), and newly added geometries are on higher numbered layers, all I needed to do was to switch things around! I put the textured background geometry on the highest number layer (10), and I put added geometries on lower number layers, I now have the added geometries show up in FRONT of the textured background which is exactly how I wanted it!

While trying to find a solution to my problem, here is what I had discovered about layers.

1. Objects on lower number layers will always show in FRONT of objects on higher number layers.
2. You can change the relative positions of objects on the same layer by employing the "Move to front" and "Move to back" selections.
3. One of the attributes for a layer is a Boolean named "dynamic". When you change "dynamic" to false, the body id of every geometry on that layer changes to -1. Then when you change "dynamic" back to true, Thyme will assign a new random body id number to each geometry. This will have negative effects on objects that are glued together or glued to the background. i.e., When you change dynamic to false and then to true, objects will become unglued! This is a known bug that I am repeating here for people who did not know this.

If I learn anything more about these mysterious layers, I will add it to this post. If anyone else has more to add, please do post it here as a reply.

Thanks!
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests