Hello! I was making a first person shooter game and I was working on an Aiming or ADS system. I went with the two cameras option but when the cameras switch, the ADS camera is in the ground? I went back in the blueprint and the camera is clearly on the gun attached to a socket.
It doesn’t matter where the ADS camera is in the viewport, that’s not where it will be. You told it to sit inside the skeletal mesh’s “camera” socket and that will take priority.
Check your skeletal mesh and see if you have the “camera” socket placed in the right location there.
Edit: If it is in the correct location, then you might need to zero out those transform location numbers in your viewpoint since they take the location of the socket and THEN add the requested transform. Right now according to that Z transform you’re instructing the camera to hover 361 unreal units below the socket location, which may well explain why it’s sitting inside the ground at the moment.
Activate is telling it “switch this camera on”, which is fine but the AK isn’t your character. When the game tries to find an active camera on your character it will never use one that’s part of a different object.
Use the switch view target with blend command instead. You’ll need a reference to the camera and a reference to the controller.
Edit: Just do the same process backwards (with a reference to the camera component on your character) to revert to the normal camera, you won’t need to use activate and deactivate at all if you use switch view target.
Oh sorry, your setup is slightly different to mine. You’re using a camera component on the AK, wheras I’m using a separate camera object.
Just plug in your AK object itself in there and if it has only one active camera component on it, that’s what the engine will use. I just tested it that way in my project and it seems to work. [Edit: So just plug in AKGun directly into that pin]
Edit: And use a reference back to the character, not the character’s camera component to switch it back again.
Your socket or camera is likely on the wrong rotation. You can try rotating the socket in the skeletal view (easier if you add a preview option) but personally I find it easier to just go into the viewport window and rotate it there until it’s facing the correct direction.
Also just on an unrelated note, it’s really lucky I’ve been helping with your answer. I found your question searching for a slightly different problem with my project (didn’t find any solutions though), and when I switched my setup over to a camera component like yours to test fixes for your question I discovered it just happened to fix my other problem I was having. So thanks.
Weird… Can you send me some screenshots of relevant screens, like the viewport and the blueprint you’re using? The basic setup should be fine, it’s exactly what I’m using and it’s working perfectly on my system so there must be some tiny thing somewhere that we’re missing.
Thanks. Here are what I think are likely causes of problems in descending order of probability.
Your ADScam component has a negative value in its transform scale. Negative scales do weird things to your coordinate system.
Your ADScam component and your socket both have different transform values. It’s much easier if one of them is set to 0, 0, 0 for rotation and you have the other rotated the correct amount.
Under the action input in your event graph I can just see the top of a commented section called ADS that seems to do some stuff with the camera. Not sure if that section is even active at the moment, but if it is that might be interfering with other things.
Can’t spot anything else immediately that looks wrong.