sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    SetCamera() function.

    Scheduled Pinned Locked Moved SketchyPhysics
    6 Posts 3 Posters 483 Views 3 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.
    • S Offline
      shareck
      last edited by

      first of all: i know nothing about ruby. i wanted to use the setCamera() function introduced in sp 3.1 but dont kno how. what i want to achieve is something like the camera script from the lazy script where you could make an object into a camera. when you play the animation the camera is positioned inside this object and is moving together with the object. any hints?

      1 Reply Last reply Reply Quote 0
      • M Offline
        Mr.K.1
        last edited by

        Put this in the Scripted field of a group and it should work

        ontick{
         eye = position
         target = transformation.zaxis
         up = [0,0,1]
         camera.set(eye, target, up)
        }
        

        It will look from the center towards the Z axis of your group, so remove the top cover and orient it how you want, or attach it to something.
        With ontick there will be a 1 frame delay between the camera and the group, this can be very useful for vehicles as the camera starts to stretch and it's an easy speed effect.
        Change ontick into onpostframe and the camera stretch will be gone.

        1 Reply Last reply Reply Quote 0
        • S Offline
          shareck
          last edited by

          Well actually it doesn't work. it worked few times for me but i dont know what am i doing wrong. will it work with sp3.2? and gsu 7?

          1 Reply Last reply Reply Quote 0
          • S Offline
            shareck
            last edited by

            Ok i got it to work. the box with the script must not be laying flat on the ground it needs to be in the air so it would movw (fall down) when the animation starts. But the other thing is that the camera doesn't tilt when the scripted box is being tilted. it always follows the line of horizon. Can that be changed?

            1 Reply Last reply Reply Quote 0
            • M Offline
              Mr. K.
              last edited by

              Oh I forgot to mention the camera has issues looking straight up.

              The up = [0,0,1] defines the camera up vector, you can change that to up = transformation.yaxis or xaxis and it will tilt along with the box.

              1 Reply Last reply Reply Quote 0
              • S Offline
                shareck
                last edited by

                This works perfect now. Thanks

                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