Announcement

Collapse
No announcement yet.

Help needed with camera blueprint

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

    Help needed with camera blueprint

    Can anyone help me out with figuring out some problems I've been having with setting up this camera blueprint shown in this tutorial [Link]? I had to make alterations to the blueprint, swapping everything related to the X-axis to the Y-axis due to the fact that the 2D sidescroller and the 3D sidescroller templates for some annoying reason have different axes from one another.

    Anyways, the first problem is that placing the camera into the scene, results in the camera up facing backwards:

    Click image for larger version  Name:	backwards_camera.png Views:	130 Size:	383.5 KB ID:	1681959

    When the camera view should like more this:

    Click image for larger version  Name:	forward_camera.png Views:	52 Size:	396.0 KB ID:	1681960

    This appears to be a problem of the camera facing along the wrong direction of the X-axis and it looks like I need to change the X Offset value connected to New Location X of the SetActorLocation event, although I'm not sure how to change so that it facing along the opposite side of the X-axis.

    The second problem I'm having is that I can't attach the camera to my player character as the blueprint setup requires attaching the camera to a object within the scene, and when I start up my game rather possessing my character that I place onto the scene, the game instead automatically spawns another version of character which is the one that gets possessed by the Player Controller. The result is that the camera ends up being the attached to the unpossessed version of my character and thus the camera will not follow the possessed character. I'm not sure why it does this as it doesn't do this in the example project provided by the creator of the camera blueprint. I don't remember if I did this myself way back when started this version of my project earlier in the year, I do remember having some sort of spawning problem regarding my player character but I honestly don't remember. I could potentially fix this, but I'm not entirely sure that I want to. You see, I want my game to have multiple characters that the player can play as and I don't I want each level to begin with my main character that's been placed into every level to be possessed, but rather for I want whatever character the player was last playing as in the previous level to be automatically spawned into the start of the next level.

    So I was wondering if anyone knows of a way to alter the camera blueprint so that instead of possessing a actor placed within the scene, it instead assigns the camera upon startup to something like maybe the Player Controller that governs the player character or something I'm not aware of, which is a lot when it comes to Unreal Engine.

    Does anyone have any ideas? I really hope I can get some input into this matter because the camera has one my biggest obstacles I've had to dealt for my project with very few options available, and this particular camera blueprint is the closest thing I've ever found to finally getting the camera working the way I want to.

    Event Graph:

    Click image for larger version  Name:	event_graph.png Views:	51 Size:	142.0 KB ID:	1681961

    Construction Script:

    Click image for larger version  Name:	construction_script.png Views:	49 Size:	178.7 KB ID:	1681962

    New Y (formerly X) Value Function Script:

    Click image for larger version  Name:	get_newyvalue.png Views:	48 Size:	231.0 KB ID:	1681963

    New Z Value Function Script:

    Click image for larger version  Name:	get_newzvalue.png Views:	46 Size:	201.2 KB ID:	1681964
    EDIT: I just added a link here [Link] to a project that contains all of the blueprints related to the camera of my game. Feel free to download it if you're willing to take a look at it and see if you can fix the problem with the camera.

    I didn't include a test enemy but pressing the 'Delete' key should do damage to the player character. Just press the key three times to destroy the player character and make them respawn.
    Last edited by Hungry Moogle; 11-20-2019, 12:13 PM.

    #2
    Okay, so I managed to fix the first problem, although not in the most ideal manner possible. I eventually found a way to rotate the camera but doing so ended breaking it and causing not to work in the way that it was supposed to. With no other options left, I decided that rather than trying to get the camera get the face right direction but to instead rearrange everything else in the scene to face the camera in the right direction. Having to rotate & re-position every element of the scene was extremely tedious, especially since I went overboard decorating what was supposed to be just a test level, but the tedium was preferable to the frustration of trying & failing to figure out how to rotate the camera.

    With that problem now out of the way, that just leaves the assigning the camera to the player issue left. After thinking about the issue some more, I honestly think that changing the scripting of the camera blueprint so that it is automatically assigned to pawn currently being controlled the Player Controller blueprint upon starting a level is the best option available. The problem though is that I'm not confident enough in my blueprinting skills to pull this off, and I'm afraid of completely wrecking the camera blueprint with my efforts.

    So once again, can anyone help out with modifying this blueprint so that it will follow the character is currently being possessed by the Player Controller blueprint? Alternatively, if you have any other ideas that might work better than my idea, then please share them, I'm always open to new options!

    Comment


      #3
      Alright, so I finally managed to figure out how to possess the character placed within the scene. It turned out that I had to enable Auto-Possess from the World Settings and not from within blueprint itself like I was trying before. As as result of this, the camera now worked as was intended, however during the course of play-testing, when my player character was destroyed I started getting numerous error messages after the camera blueprint had been assigned to my player character.

      Click image for larger version

Name:	erro_log_2.png
Views:	88
Size:	407.0 KB
ID:	1687659

      These error messages were extremely concerning to me although they didn't seem to have any adverse effects on my game. However, my concerns were later validated after I implemented a respawning system to my game, where upon after the player respawned at the start of the level, the camera would end up completely borked. For some reason, the camera appeared to be inside of my character, as bits of my character's mesh are visible when they perform certain actions like swinging their weapon or crouching.

      I'm not really a programming or engineering sort of person but based on the error messages as well as the way that the camera blueprint is setup, led me to believe that the source of this problem stemmed from the fact that the camera blueprint has no permanent fixture to the player character. When the camera was located within the player's blueprint, upon death the camera would respawn along with the character. However, since this camera is it own blueprint, when the player character is destroyed, the camera remains but isn't attached to anything and the blueprint doesn't have any way of reassigning the camera to a newly spawned character.

      This why I would to like to change the camera blueprint so that the camera is assigned to the player character via the Player Controller blueprint. This way, the camera will always have a way of being assigned to the player character no matter how many times they are destroyed because the Player Controller has a permanent presence unlike the player character. Like I just said, I'm pretty far from being the most technical person around so I'm not sure if my idea is the best approach to take or not, so I'm open to other options or ways to improve my idea if anyone is willing to lend a hand.

      Comment


        #4
        So tried I removing everything from the Construction Script and instead moving it over to after the Set View Target with Blend event in the Event Graph and then changing all the references in New Y & Z Value functions, as well as the Event Graph, from the Actor to Follow variable to instead the Get Player Character event.

        Event Graph:
        Click image for larger version

Name:	event_graph_2.png
Views:	44
Size:	336.2 KB
ID:	1688003

        New Y Value:
        Click image for larger version

Name:	get_newyvalue_2.png
Views:	44
Size:	166.5 KB
ID:	1688004

        New Z Value:
        Click image for larger version

Name:	get_newzvalue_2.png
Views:	41
Size:	214.3 KB
ID:	1688005

        In the end though the changes I made to the camera blueprint do not seem to have made any difference at all in regards to the camera problem upon the player re-spawning. The changes didn't make things worse but the core issue at hand remains completely unchanged.

        The only thing that has changed is that the number of errors displayed in the Message Log has changed from almost 14,000 to only 2 remaining:

        Click image for larger version  Name:	mystery_error.png Views:	0 Size:	23.1 KB ID:	1687999

        Unfortunately, I haven't been able to decipher these error messages are referring to in regard to my camera problem. What I particularly don't understand is why the two error messages mention the Goonie blueprint, which the blueprint for the test enemy I'm using, that is unless its simply saying the error is a result of the destruction of the player character upon the player colliding with the Goonie test enemy and not the Goonie directly?

        All of this camera blueprint stuff appears to be way over my head and I am in a dire need of someone to point me in the right direction of how I can fix this problem.
        Last edited by Hungry Moogle; 11-17-2019, 02:59 AM.

        Comment


          #5
          I made a simple project that contains everything related to the camera blueprint for my game and added a download link above in my initial post. Alternatively, you can download it from here instead [Link].

          Comment

          Working...
          X