x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

#1 Why is my ADS camera messed up when creating an Aiming Down Sights (ADS)?

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.

https://imgur.com/a/H2pUbwh

Why is this happening and how can I fix this? Is it even possible to make an ADS system this way or is there a better way? Thanks!

Product Version: UE 4.21
Tags:
more ▼

asked Jan 06 '19 at 06:00 PM in Blueprint Scripting

avatar image

CODE REDBALLG
115 2 7 17

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

https://imgur.com/a/WVS94WP

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.

more ▼

answered Jan 07 '19 at 12:57 AM

avatar image

MKenner
41 1 3

avatar image CODE REDBALLG Jan 07 '19 at 01:03 AM

Hey there. I have a picture of where my socket is and I keep changing it but the camera is stuck in a weird angle on the back. Here are my pictures:

https://imgur.com/a/61lOhLd https://imgur.com/a/SOlFdFx

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Oh, you're using the wrong command.

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.

https://imgur.com/a/ogPw3QW

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.

more ▼

answered Jan 07 '19 at 01:10 AM

avatar image

MKenner
41 1 3

avatar image CODE REDBALLG Jan 07 '19 at 01:18 AM

So what do I put on the this pin? It says my camera can't go in the pin

https://imgur.com/a/vzYPnmv

avatar image MKenner Jan 07 '19 at 01:26 AM

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.

avatar image CODE REDBALLG Jan 07 '19 at 01:36 AM

So I tried that but it shows me this angle. I tried moving the cameras but that didn't work :/

https://imgur.com/a/ncX8fBB

avatar image MKenner Jan 07 '19 at 01:46 AM

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.

https://imgur.com/a/sBB7BrO

avatar image CODE REDBALLG Jan 07 '19 at 01:59 AM

So I rotated everything and it still looks like the picture above

https://imgur.com/a/EcfNkdH https://imgur.com/a/RN2wGHx

avatar image MKenner Jan 07 '19 at 02:07 AM

Untick use pawn control rotation

https://imgur.com/a/EG8H4MR

avatar image CODE REDBALLG Jan 07 '19 at 02:12 AM

Did it and it is still the same :/

avatar image MKenner Jan 07 '19 at 02:18 AM

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.

avatar image MKenner Jan 07 '19 at 02:24 AM

Here's how everything's set up on mine and you can see it's working.

https://imgur.com/a/RL8WyqR

avatar image CODE REDBALLG Jan 07 '19 at 02:27 AM

Here is my stuff: https://imgur.com/a/OaL4V3u

avatar image MKenner Jan 07 '19 at 02:32 AM

Thanks, can I also have a look at the current viewport window for the ADSCam component of Gun_AK47?

avatar image CODE REDBALLG Jan 07 '19 at 02:42 AM
avatar image MKenner Jan 07 '19 at 02:47 AM

Thanks. Here are what I think are likely causes of problems in descending order of probability.

1) Your ADScam component has a negative value in its transform scale. Negative scales do weird things to your coordinate system. 2) 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. 3) 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.

avatar image MKenner Jan 07 '19 at 02:54 AM

Or it actually might be this.

4) In the ADSCam component, one of the options down near the bottom "auto-activate" is currently not ticked. It should be ticked.

https://imgur.com/a/9kpZoEB

avatar image CODE REDBALLG Jan 07 '19 at 02:58 AM

I did everything you said to do but the camera is still in my character's chest at an awkward angle. I took away all the negative values and set them all to 0,0,0 in my view port, Adjusted the socket transformation. And the ADS part was just changing the FOV but it wasn't linked. I also set it to auto-activate but it doesn't work :(

avatar image CODE REDBALLG Jan 07 '19 at 03:07 AM

Oh wait it worked :) Just how do I fix my line tracing? https://www.youtube.com/watch?v=JumboeohzlU&feature=youtu.be

avatar image MKenner Jan 07 '19 at 03:14 AM

Looks like your gun isn't in the centre of the screen, which it probably should be since the camera is literally socketed to the gun. Maybe try adjusting the position of the socket to get it in the right spot for the gun to be fairly centrally located.

Also you might want to adjust the project settings -> engine -> general settings -> 'near clip plane' to a lower value to stop the camera clipping inside the gun.

avatar image CODE REDBALLG Jan 07 '19 at 03:27 AM

I did this but the line trace is going all over the place: https://imgur.com/a/qWMDlVH

avatar image CODE REDBALLG Jan 07 '19 at 02:32 AM

Here is my stuff: https://imgur.com/a/OaL4V3u

avatar image MKenner Jan 07 '19 at 02:16 AM

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. :)

avatar image CODE REDBALLG Jan 07 '19 at 02:27 AM

Ha Ha. Thanks so much for helping me lol!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question