• Login
sketchucation logo sketchucation
  • Login
ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

SetCamera() function.

Scheduled Pinned Locked Moved SketchyPhysics
6 Posts 3 Posters 483 Views
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 30 Jun 2011, 23:00

    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 1 Jul 2011, 06:51

      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 1 Jul 2011, 18:16

        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 1 Jul 2011, 18:31

          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 1 Jul 2011, 20:04

            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 1 Jul 2011, 20:14

              This works perfect now. Thanks

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

              Advertisement