" Aiming Down Sights- The CORRECT Way | UE4 Tutorial"
im following this tutorial for aiming, since ive been trying to implement it for ages now and no tutorials have worked. this one has gotten so close, but I think it has to be that one of my settings on the camera is causing this issue.
doesnt matter what values I put in for the make vector node, it will always go to here. is there a setting for my camera which could cause this? I had an issue at the beginning where either my entire mesh would rotate with the camera or the mesh wouldn’t rotate at all, and spring arms wouldn’t work, and I don’t recall how I fixed it.
The picture shows the issue, but it would help to see what your bp code looks like. Mayhaps your spring arm settings and such. The more of your work that encompasses this issue, the better!
flip flop A,
then flip flop B
I don’t have a spring arm. yeah. it was glitching like crazy so I just used a normal camera without one.
Right, the spring arm can be tricky.
What is inside each timeline and what does the Get Sights Vector function look like?
thats get sights, and the timeline is just a 0-1 float track.
by the way do you have any tutorials on spring arms in a TRUE fps? I want to do it but I just cant find anything.
There does appear to be some differences between what you have and the tutorial you are following. Some of it is blueprint and another is the naming of things. I don’t believe the difference in naming is too important so long as you recognize it.
You may want to setup up everything like the tutorial and then modify for your specific needs to make sure it works in the first place. Otherwise, from what I can see, there is not enough to determine where the problem might occur. Based on what I am seeing, its a guess of not having the socket setup correctly via positioning/naming, the isAiming bool is always set true in the flip flop, or that there is a logic flaw with the Get Sight Vector function (perhaps the break vector area or Transform Space).
dang never mind abt the camera I just did the spring arm myself. just ticked on pitch yaw and roll and it started working like expected. good.
the bool being set to true is just me being an idiot, but thats only for the Animation bp. I will check the get sight vector function, because the socket is named and positioned right.
ok so I redid the tutorial. I did have set world location instead of relative, but now it works well. except for the fact that it goes up to the heavens.
when I aim I go up around 5000 units or so. no idea why. its the function not using the socket location (even though it can read it, used print string to check)
Once again, the picture shows the issue, but it’s still relevant to see all code and other work involved to pinpoint any kind of problem. Shots of blueprints, the setup of the spring arm and all of it’s settings, camera too, socket, etc. If you want clear help, you must provide your work to be reviewed over. There is a marketplace plugin that can allow you to take large screenshots of your blueprint graph if it is too much to mockup in pieces.
aim code in totality (the thing its connected to is just the input aim event):
Thank you. How are you setting the MainCameraPosition variable? Is that just a number or set from another object’s property? If so, what object?
It might also be worth testing the results without the timelines as they are just for blending between locations. Your events could simply set the actor location. This would test without the GetSightsVector function.
I tried a new idea: set a child actor right where the camera was. and it works. its off by a tad, but I can probably fix that. whats weird is every time I unaim, it the camera goes up more, but ill see if I can fix that on my own. thank you for your help
Sure thing, and the slight camera shift might be related to how the MainCameraPosition is being set.
im sorry Conrad. ive returned.
the aiming relatively works. the problem is whenever you move. I hadnt tested it out while moving a lot, I had only tested it moving around a little platform. so the issue is this: whenever I aim after ive moved just a couple of feet, the camera will go up to the skies. just like before. if ive moved to the other side of the map, it’ll completely go haywire and be as far as it could be. if I move backwards over a ledge, even while not aiming, it will move the camera below the floor. Why cant this just work the way I want it to?!? ive put almost 25 hours into this one basic mechanic that tutorials will do in minutes. comes with the business I guess… @AntiGravity you got any advice here?
the ss is how I set the camera position. child actor is a child of the spring arm and not the camera, so it saves the default position of the camera.
here’s a video of the problem.
Yes, I see what you mean. As mentioned, cameras are tricky - to expand, I don’t believe we can treat them like any other object with a transform because of it’s unique interaction with input and character.
In any case, it’s still rather hard to determine the culprit from what you’ve shared, which is plenty, but of course testing things myself would obviously give me full control, this is time I don’t currently have to spend.
Here are my guesses
- Main Camera Position: it looks like you are logging this value, and it may help to log it throughout the stages of its use, i.e. whenever it is set as a value. I see on Tick, it is a relative set, to some child actor (which is?)
- Get Sight Vector function: is getting the socket transform, which I assume is by default in world space, not local/relative space. Curious… Additionally, the coordinates from the break vector into the make vector could simply be wrong. Might be worth changing these around to see what differences occur - again, I’m not there with you, so naturally I would start poking around at places that I feel are influences around the issue.
- The lerp(vector) for your timelines are choosing between these values to set the Main Camera’s location. The Main Camera Location which is always the “relative” location of Child Actor (maybe its shouldn’t be relative?) and the Get Sight Vector function which is using the assumed world location of the pistol. (Although I do not understand what RTS Parent Bone Space specifically does).
Again, I would suggest removing the timeline aspect and simply set the location. This would be immediate, but I would imagine it reduces the number of places to debug this problem. So instead of a lerp, just use one of two location fetching methods, the Main Camera Position or the Get Sights Vector function, one for ON and the other for OFF.
EDIT: And one more thing to note is that of the Camera itself, since there could be other influences based on the camera class, spring arm, and/or character that can add to this.