Announcement

Collapse
No announcement yet.

Always look at the fastest actor with the camera!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Always look at the fastest actor with the camera!

    Hi everyone.

    I have a problem that I cannot find a solution to and I hope someone can help me.

    I have 7 actors moving at different speeds randomly along the X axis and I would like my camera to move along the X axis at the speed of the fastest to make sure I always show the first runner.

    Do you have any suggestions?

    Thanks!

    #2
    Originally posted by Delemir78 View Post
    Hi everyone.

    I have a problem that I cannot find a solution to and I hope someone can help me.

    I have 7 actors moving at different speeds randomly along the X axis and I would like my camera to move along the X axis at the speed of the fastest to make sure I always show the first runner.

    Do you have any suggestions?

    Thanks!
    You can use the GetVelocity node to figure out which actor is moving the fastest and point the camera at them.

    Exacly how you do that depends on a lot of things like:

    1) Are these just actors being moved by the level BP?

    2) Are they BPs moving under their own steam?

    3) Is there a camera just sitting in the level?

    4) Is there a player character watching, and you intend to move the player camera?

    5) Is there a BP containing a camera in the level?

    Etc yada yada yada...

    Comment


      #3
      The knot you suggested is really very interesting and I think it will be useful in other situations as well. In my project, however, the speed of the actors constantly changes randomly and not necessarily the fastest is also the one further ahead on the x axis.

      in the project the actors move by themselves directly from their event graph.

      In the level there is a camera that is not part of any blueprint.

      My initial idea was to use Event Tick to read the vector X value for each actor and select the highest one with the Max node and then set the Camera location to this value.

      Sorry for my English...
      Last edited by Delemir78; 09-19-2020, 12:18 PM.

      Comment


        #4
        Originally posted by Delemir78 View Post
        The knot you suggested is really very interesting and I think it will be useful in other situations as well. In my project, however, the speed of the actors constantly changes randomly and not necessarily the fastest is also the one further ahead on the x axis.

        in the project the actors move by themselves directly from their event graph.

        In the level there is a camera that is not part of any blueprint.

        My initial idea was to use Event Tick to read the vector X value for each actor and select the highest one with the Max node and then set the Camera location to this value.

        Sorry for my English...
        Your idea sounds fine. Have you tried it?

        Comment


          #5
          Originally posted by ClockworkOcean View Post

          Your idea sounds fine. Have you tried it?
          Yes, I tried and it works, but the camera moves constrained to the framerate and I noticed that the actors occasionally pulsate graphically as if it were a glyc. if I put a fixed or independently moving camera it doesn't happen so I thought the problem was the event tick.

          Comment


            #6
            Originally posted by Delemir78 View Post

            Yes, I tried and it works, but the camera moves constrained to the framerate and I noticed that the actors occasionally pulsate graphically as if it were a glyc. if I put a fixed or independently moving camera it doesn't happen so I thought the problem was the event tick.
            Can you show the code?

            Comment


              #7
              Originally posted by ClockworkOcean View Post

              Can you show the code?
              Click image for larger version

Name:	Screenshot 2020-09-20 11.12.32.png
Views:	49
Size:	404.3 KB
ID:	1813472

              The problem with my code is that once in a while the actors have a glich, they disappear and reappear a couple of times very quickly.

              If instead I move the camera for example by binding it to one of the runners it doesn't happen.

              Could it be the event tick? Could I improve the blueprint using delta second?

              Comment


                #8
                Originally posted by Delemir78 View Post

                Click image for larger version

Name:	Screenshot 2020-09-20 11.12.32.png
Views:	49
Size:	404.3 KB
ID:	1813472

                The problem with my code is that once in a while the actors have a glich, they disappear and reappear a couple of times very quickly.

                If instead I move the camera for example by binding it to one of the runners it doesn't happen.

                Could it be the event tick? Could I improve the blueprint using delta second?
                You're setting the camera with a jolt.

                Try it like this:

                Click image for larger version

Name:	vinterp.JPG
Views:	53
Size:	224.0 KB
ID:	1813500

                Comment


                  #9
                  Originally posted by ClockworkOcean View Post

                  You're setting the camera with a jolt.

                  Try it like this:

                  Click image for larger version

Name:	vinterp.JPG
Views:	53
Size:	224.0 KB
ID:	1813500
                  Great, I'll try it now, thanks so much!

                  Comment

                  Working...
                  X