G
gabriabel

  • Nov 30, 2021
  • Joined Nov 4, 2021
  • Anthony
    Hi!

    Turns out, it was because I already edited a lot of your base scripts, and some of those changes made that error appears.
    So I decided to try another approach for this one as a workaround, which doesn't require the game to follow the object.

    I wanted to give you a sample project based on my current one but I cannot recreate it anymore haha 😅. And because this error is a special case, I don't think you have to worry about it anymore. Thanks again!

  • Anthony Hi, thanks for the reply!

    1. Sorry, it seems that my video is not clear enough 😅. The object doesn't disappear from the scene, it's just the camera somehow not "following" the object. Assuming that "focus" and "following" is different function altogether, the problem is not the "focus" on the object but the "following" on the object. In this video, you can see that the "focus" function is okay. But when I trigger the "following" function, the camera started to shake a lot.
      Is it because there is some line of codes that overlaps with each other? If you feel like this is not enough information, I can send you an example project for this case

    2. Ah I see! Before, I only tried to change the finalPosition's value and not recalculate the whole thing. I didn't reconsider the new center of the camera at all. That's why the camera gets "stuck" to its initial position after I changed its position. Just tried it again with something like this and it works:

                  if (Input.GetKey(KeyCode.LeftArrow))
                  {
                      // temp line for testing only
                      finalPosition = new Vector3(finalPosition.x - 0.1f, finalPosition.y, finalPosition.z);
      
                      Vector3 newWorldPointCameraCenter = CalculateNewCenter(finalPosition, finalRotation);
                      finalOffset = newWorldPointCameraCenter;
      
                      finalPosition = CalculateNewPosition(finalOffset, finalRotation, finalDistance);
                  }

      From here on I can adjust it based on what I needed. Thanks for the insight! 😁

    • Hi again!

      I noticed on your manual that you have Following Object feature, and it works perfectly on its own! Although when I tried to integrate it with your Home Designer asset, the camera starts to not work properly for its furniture after I trigger this event
      CameraEvents.OnRequestObjectFollow?.Invoke(gameObject, focusOnFollow);
      Am I doing something wrong? Or maybe you already have it in your demo scene, but it's just me that missed it haha? 😅

      For another question, I tried to add a simple function to move the camera with a button input based on your CameraPerspective.cs script. But it seems that you need to click/tap the screen in order to calculate the movement. Do you have solutions in mind to approach this one?

      Sorry for the double question! Not sure if I should separate it into different discussions or not haha 😅

      • Awesome! Just tested it myself and it works like a charm. Turns out the solution is not as complicated as I thought haha😅

        Thanks for the support!

        • Hi,

          I just bought your assets and it was amazing! However, it started to create some unwanted behaviors when I changed the camera's viewport coordinate. In this case, I changed the X and Y to 0.5 respectively

          The distance suddenly gets fixed to the minimum value, the scrolling function doesn't work properly anymore, etc. You can have a look a this video. Though maybe it is not very noticeable in the video, I hope you understand what the problem is.

          My temporary measure is to hardcode the finalDistance to a certain fixed value because I don't understand how the calculations in CameraBase.cs works 😅. But it only solves one problem and doesn't fix the others. Do you have any solutions for this one?

          Regards,
          Gab.