sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Behavior: shadows_face_sun

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 4 Posters 781 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tpoz
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        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

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • R Offline
          RickW
          last edited by

          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.

          RickW
          [www.smustard.com](http://www.smustard.com)

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Think there was a DC that followed the sun...

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              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...

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                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

                1 Reply Last reply Reply Quote 0
                • R Offline
                  RickW
                  last edited by

                  @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 😉

                  RickW
                  [www.smustard.com](http://www.smustard.com)

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    I was talking out the top of my head again... 😉

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      tpoz
                      last edited by

                      Hey,
                      It turns out that thomthom's first suggestion was the one!
                      I thought I had tried that, thanks for the posts everyone!

                      Laura

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement