Tweeining a camera to a moving target position

FlowCanvas Forums Support Tweeining a camera to a moving target position

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #963
    stereomike
    Participant

      Hey,
      I try to add some camera views to a moving car with FC and DOTween. But the tween goes the last obtained position (position before the tween is started), not the current, moving one. So, if the tween takes 3 seconds, the car already moved 3 seconds away from that position and the camera is never at the spot I wanted it to be.
      Any idea for what to look for? Thanks!

      Attachments:
      You must be logged in to view attached files.
      #966
      Gavalakis
      Keymaster

        Hey,

        Yes. This is how Tweens work in general, in that while they are updated, they tween a Vector3 value from one Vector3 to a target Vector3.
        If what I understand you want to do is correct and you want the camera to always “stick” to the randomly selected spot even while the car is moving, bellow is a flowscript that does this for your convenience.

        [attachment file=”CameraRandomSmoothMove.png”]

        Let me know if you need any details on how/why this is working 🙂

        Cheers!

        Attachments:
        You must be logged in to view attached files.
        #968
        stereomike
        Participant

          Thanks Gavalakis,

          in both goups, there’s a small in-out item on top left, what’s that?

          Thank you!

          #969
          stereomike
          Participant

            Sorry, just found it, it’s a ‘dummy’ element for organiziation of nodes

            #970
            stereomike
            Participant

              May I ask, what node is that in the lower group on the left spot,spot(1) and spot(2)? I tried to hook a ‘get position (vector3) into the transform collection, but it won’t allow it.

              #971
              Gavalakis
              Keymaster

                Hey,

                It is a Transform variable ( “Variables/Graph Variable (Transform)” ).

                You can easily create such a variable though, by simply drag and drop the gameobject you want from the scene in the canvas and then in the popup that will show, select ( “Transform/Graph Variable (Transform)” )

                [attachment file=”TransformVariable.png”]

                🙂

                Attachments:
                You must be logged in to view attached files.
              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.