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 = trueI've tried a few other things like
behavior = model.definitions[0].behavior beehive = behavior.always_face_camera = trueI 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_sundoes 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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement