Vinterp not working, despite my best efforts

Ive done about 4 tutorials already and keep experiencing the same problem. im doing a vinterp to for aiming down sights so the camera moves to it, but alas, it can never be that easy.


and that is the ss of the vinterp. any idea of what’s wrong? I’ll provide any screenshots needed.
I have to add more screenshots in the replies because the forum is a jerk and won’t let “new people” (even though ive been registered for TWO YEARS) post more than one photo at a time. its just great.

the problem is it just teleports the camera to the pistol, not moving it slowly. then you unaim and it doesnt go back to the main camera. I have a separate un aim function, but we can fix that after the aim function.


that’s the button code

What is actually calling Aim Pistol? It seems to just hang there, all disconnected and abandoned.

ah right. I forgot sorry. the function is part of the first tutorial I did. same with the function I first gave. the stuff connected is actually what’s in use right now. both have the exact same outcome though. I have a feeling it has to be in the settings, because why wouldn’t it work for either? id prefer the function one though. much clearer, and I think timelines are slightly worse on performance.

So what are we investigating? The timelines not working or the vInterp?

preferably the vinterp. i do believe they both stem from the same problem though.


more code. ignore what the delta seconds are connected to, from first tutorial.

Sorry for not getting back to you earlier, it got really late all of a sudden… Not going to advise on the technique behind the desired behaviour (not sure how you need it to work and it’s not my field - only chipping in because of the interpolation) but if someone made me do it with interpolation, I’d refuse; and if they insisted, I’d give them this:

  • use sockets on the skeletal meshes instead of arrow components (here only to visualise it better)
  • you’ll need to redo how the whole thing rotates as the camera can no longer utilise pawn control rotation in this very setup, or decide what is really supposed to happen:
    – are we bringing the gun to the face?
    – are we bringing the face to the gun?
    – a bit of both mayhap?
  • and I probably would not use 2 cameras unless that was really needed for some snazzy behaviour further down the line
  • you could experiment with Set View Target with Blend but it may get tricky, you’ll need to store intermediate transform manually - the node is not too clever (unless some changes were made to it in the last couple releases)

This is, generally, a job for a Timeline - more control and each weapon actor can have its own unique curve, offsets (sockets!) and so on.

I do mine with a second camera and Set View Target with Blend. Seems to do just fine.

2nd camera is created in construction in the weapon parent class and socketed just behind sights. I have an vector offset variable for adjustments per child.

3 Cams: TFPP, 3PP, Gun

2 Likes

I was actually considering summoning you, hoping for your insight.


Since you’re Set View blending between 2 cams, how do you handle blend interruption? Or you do not allow for interruption?

Haven’t run across that. Have an example?

In the very first second of your vid, you blend between 2 cams, right? Your transition is fast so it’s all nice & dandy, looks pretty good!

Imagine it lasted 5s instead but you decided to go back to the 1st camera mid blend.

Now, the Set View is blending - which camera do you think you’re actually moving? And if you decided to move back to the 1st cam and blend from the 2nd cam → 1st, you’d get a very jarring transition / snap.

One way to handle it is to never allow the player to interrupt the transition. If you decided to go ADS, you must go full ADS and can only go back once you’re done.

The problems with Set View become imminent when you try to interrupt it.


Example:

  • player with 2 cams

  • if I let the transition finish its 2 second blend:

  • and if I do not allow the blend to finish its job:

The Set View has absolutely no idea what is going on if you interrupt it. The only workaround I ever found:

image

Stop the transition and continue manually. And that’s why I generally avoid the node unless it’s truly a fire & forget thing. Probably irrelevant for something as fast as going ADS, though.

@anonymous_user_f27400311 Apologies for the thread hijack!

1 Like

Ahh gotcha. Thought it would be something like that, just wanted to be sure.

At the moment it all works on Input command. Eventually there will be IK on the weapon to reduce clipping (weapon will move). At that point I’ll be using a few events and possibly anim notifies in the montage, and maybe even intermediate position sockets… Or spring arm the camera and adjust it on the fly.

I’m sure whatever I do it’ll be creative.

1 Like

Here’s my settings at the moment for the blends.

The blend time is so fast that there’s no real issue with snapping. But I will eventually have to deal with some level of interrupts when in full ads.

1 Like

Yeah, since you can click more than 4 times per second, were you to spam the button, you’ll notice the snap. Prevent the player from spamming it more often than every .25s → problem solved :smiley:


@anonymous_user_f27400311 - perhaps neither the TL or Interp is required. If you do not need a specific, granular control over the path of the camera to the destination and the transition is fast, a Blend may be enough.

can you send me your whole blueprint? im a noob sorry, I barely understand any fo this.

Sure thing. My weapons setup is a bit advanced, but I’ll snip only the important stuff.

Parent Weapon Class … Construction script → Add Camera Component, Attach to Gun mesh socket

After Camera addition we set a reference variable for it (Gun Camera). You’ll need it for ADS shooting.

Result:

My Weapons aren’t part of the character class. They are spawned in after pawn creation and attached to the pawn mesh.

Character Class Begin Play:: Spawn Weapons:

In the parent weapon class I have a “Char Ref” variable that is editable and exposed on spawn. This adds a reference to the owning pawn with out the need to cast.

Aiming Down Sight :

The IsADS? boolean is used in the animation graph state machine for transition to and from the ADS “State”.

Additionally I have a variable that references the players current camera. When I change perspectives FPP/3PP this variable is updated. It is “NEVER” set to reference the gun camera. Its purpose is to help determine which camera to use for shooting logic. If in 3PP I need to use the 3pp cam, otherwise fpp cam. If ADS always the gun cam.

All firing logic is in the parent weapon class. There I do a simple check [IsADS?] pulled from the weapons char reference. If true I use the gun cam, otherwise “Current Camera”…again pulled from the char reference.

e.g. projectile camera is a function local variable.

Cam toggle:

1 Like

I have my gun set up inside the players blueprint. not the smartest decision on my part, but its what I did. how can I plug an actor made inside my BP into the actor reference? I tried child actor, sadly doesnt work. if anything, ill just recreate the gun inside a separate BP, but Id rather not.

Will you ever have only 1 gun? If so, that’s probably fine. If you plan to have more than 1, this is already a dead end… A gun should be an (inherited!) actor so it can track its own data, has its own functionality and so on.

This sounds confusing. Why wouldn’t you be able to plug an actor into an actor reference? You may need to explain this attempt.

Perhaps you mean this: the Child Actor Component is a component that holds onto an actor. You can see the CAC’s actor accessed in those animations: Vinterp not working, despite my best efforts - #11 by Everynone

I have 2 guns. to be honest, ill just make separate guns. ill get back to you all in a sec

Create a weapon parent class … mesh, vars etc then create child class for each gun.

You can then code all your firing, reloading etc logic in the parent and it will apply to the child classes.