Browse Search Popular Register Upload Rules User list Login:
Search:
3D Shadows Follow Light

Image:
screenshot of the scene

Author: Xray

Group: Default

Filesize: 130.22 kB

Date added: 2014-03-15

Rating: 5.9

Downloads: 1078

Views: 370

Comments: 10

Ratings: 3

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

Use the arrow keys to move the lamp around and watch the shadows follow it. Interesting 3D effect.

UPDATE: 1. Cleaned up script per s_noonan's suggestion.
2. Fixed shadows so that they don't turn white, per lololoer's suggestion. Thanks guys!
Last edited at 2014/03/16 18:51:56 by Xray
Please log in to rate this scene
edit
Similar scenes
Title: SHADOWS OF VARIOUS OBJECTS
Rating: 6.2
Filesize: 68.81 kB
Downloads: 928
Comments: 2
Ratings: 4
Date added: 2013/07/25 05:18:40
Made with: Algodoo v2.1.0
Rating: rated 6.2
download
Title: How shadows work
Rating: 5
Filesize: 24.88 kB
Downloads: 121
Comments: 0
Ratings: 1
Date added: 2019/09/14 21:32:47
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Dynamic shadows (easier code)
Rating: 5.8889
Filesize: 53.6 kB
Downloads: 1286
Comments: 10
Ratings: 3
Date added: 2013/11/05 17:28:19
Made with: Algodoo before v1.8.5
Rating: rated 5.9
download
Title: Lazerz
Rating: 5
Filesize: 67.18 kB
Downloads: 142
Comments: 0
Ratings: 1
Date added: 2015/12/05 03:47:36
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Light Marble Pack With Tools.
Rating: 5
Filesize: 65.65 kB
Downloads: 384
Comments: 0
Ratings: 1
Date added: 2015/02/15 08:16:33
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Marble Camp (14/31) [Reupload 3]
Rating: 5
Filesize: 21.07 kB
Downloads: 418
Comments: 2
Ratings: 1
Date added: 2015/05/20 04:29:27
Made with: Algodoo v2.1.0
Rating: rated 5
download
b = math.atan2(scene.my.lampPos(1),scene.my.lampPos(0)­);
a = math.vec.len([scene.my.lampPos(0),scene.my.lampPos­(1)]);
I had a feeling that it could be simplified. Thanks!
Cool, but it has a little problem, when the lamp comes near the center [0, 0] the shadows becomes white for a while.
Last edited at 2014/03/16 17:30:48 by lololoer
s_noonan - When I copied and pasted your two lines of code into my scene, Algodoo returned a bunch of errors in the console. The code visually looks Okay, but when I copied and pasted those two lines into Notepad++, this is what they looked like:

a = math.vec.len([scene.my.lampPos(0),scene.my.lampPos­­-(1)]);
b = math.atan2(scene.my.lampPos(1),scene.my.lampPos(0)­-­);

Somehow those minus signs snuck into your code, but they cannot be visually seen until pasted into a text editor. WEIRD! :s


lololoer - Yes, I knew that but I didn't bother to fix it. Now that I'm modifying the code per s_noonan's suggestion, I will see if I can improve it.

My thanks to both of you.
Yep. Works well. Too bad the [code]Code Tags[/code] don't work in Algobox.
What does the code tags have to do with this scene? :huh:
When code tags are used in the forum, you can copy and paste code with no problem. When code is added to the scene comments in Algobox, copy and pasting the code may or may not work (as you mentioned in your 2nd comment above).
Oh, yes. It did not click in my brain at first what you were referring to, but now I know exactly what you meant. We (Admins) had a discussion some time ago about the possibility of combining (or somehow overlapping) Algobox with the Forum so that:
1. Users would not need two separate accounts.
2. All bb codes and tags will work consistently between the two.

Unfortunately, anything concerning Algodoo (the program, the forum, or Algobox) currently has a low priority because Algoryx, understandably, is focusing their time and talent on their money-making products. So, it may be a long time (if ever) when they will update any of this. I just hope and pray that they do not pull the plug on it and kill it! :cry:
Good new update!
BTW:
I know that it's out of work-space limits but if you move the lamp out (killing the planes on the sides) the shadows of the background don't appear as they should, I suggest you to use: setMax = (variable, maximum)=>{ variable < maximum ? variable : maximum};
setMax(texturematrix(vector), maximum_vector_distance)
Last edited at 2014/03/18 16:23:45 by lololoer
lololoer - Thanks very much for the suggestion, and it's a good one! But I don't want to spend any more time on this scene, and so if you would like to improve it in any way, then be my guest! :)