Behavior: shadows_face_sun
-
Hello everyone!
I have a question about behavior. I am trying to draw a 2d component and have it follow the sun using .shadows_face_sun. I can't seem to make it follow the sun.
Here is some code:shruw = 15 shruh = 20 shr0 = [shruw/2,0,0] shr1 = [-shruw/2,0,0] shr2 = [-shruw/2,0,shruh] shr3 = [shruw/2,0,shruh] point = Geom;;Point3d 0,0,0 transform = Geom;;Transformation.new point trees = model.definitions.add("MyShrub") shrubbie = trees.entities.add_face(shr0, shr1, shr2, shr3) shrubbie.material = "ForestGreen" shrubbie.back_material = "ForestGreen" model.active_entities.add_instance(trees, transform) model.active_view.zoom_extents trees.behavior.shadows_face_sun = true
I've tried a few other things like
behavior = model.definitions[0].behavior beehive = behavior.always_face_camera = true
I think I am using the definition wrong or something when i use behavior.
Any help is greatly appreciated!
Thanks,
Laura -
Have you checked the definition you get when you use
model.definitions["MyShrub"]
?
In any case, just use the name if you know it.behavior = model.definitions["MyShrub"].behavior
-
You are aware that
shadows_face_sun
does not affect the representation of the component instance itself, but only its shadows, right? In other words, the instance will not rotate to follow the sun; only the shadows will change when the sun changes while the instance remains static. -
Think there was a DC that followed the sun...
-
DCs got it built in:
http://sketchup.google.com/support/bin/answer.py?hl=en&answer=115749
SUNANGLE()
not sure if it auto updates though...
-
There are several plugins that get the sun's position [e.g. Jim's suntool.rb].
You need to find it and use it to determine you component's rotation in 3D ?
Could be a DC [sunangle_function.skp etc on 3DWarehouse] or a Component with attached an observer that finds the sun an rotates it to suit - triggered by some event - like a change of the view ? -
@tig said:
...or a Component with attached an observer that finds the sun an rotates it to suit - triggered by some event - like a change of the view ?
or a ShadowInfoObserver
-
I was talking out the top of my head again...
-
Hey,
It turns out that thomthom's first suggestion was the one!
I thought I had tried that, thanks for the posts everyone!Laura
Advertisement