I have made a gun actor with a camera in it for aim down sights, now on my character’s aim function i have set up set view target with blend to casting to the gun actor, instead of going to the gun’s camera, it goes to the center of my players body
What happens when you blend to the camera in the gun?..
the camera enters my players body instead of going to the gun camera
Can you show some code?
here is the code
ah… what is the variable ‘Rifle2’? Is a reference to a Rifle2?, then you still need to pull a pin off and do ‘get GunCamera’ ( before you do the blend ).
it says this
You’re right, you give the gun BP, and it finds the camera component. Darn.
If you put the gun just lying somewhere else in the level, does the view target work? Is it to do with holding the gun?
it does work, sometimes, it goes to the location where the rifle was placed on the ground ( but since the rifle is on my players hand socket, the camera wont track the gun thats on my players hand
So, I made a little project where this concept works. The gun:
You put it as a child in the 1st person:
Then you use this code ( bit ■■■■ but it works ):
Result:
Tell me if you can’t get it working, and I’ll send a link.
The problem is i dont have a child actor or a skeletal mesh on my character to define the “gun”
I am using the battle royale template from marketplace and it uses a equip system, where you pick up a gun from the ground and it gets equipped to the socket of the character
It has to be an actor with a camera attached to it otherwise the blend wont work. The blend will find the camera on the actor given, if it can’t figure out which camera to use, that may be your problem…
I have the camera on my Rifle2 actor as you can see
Ok, apparently, you can change cams when you have multiple cams in one actor with the SetActive node:
Give that a go…
You lost the blend, but it will switch. I you really want the blend then you might have to actually just move the FP camera… But I really don’t get it since your gun IS a separate actor…
It works but not at all as i want it to, the camera is not attached to the iron sights like it was in my gun actor, the camera rotates along the torso of my character
Are you switching to the cam in the gun?
When your player is holding the gun, use F8 to pop out and take a look at where the gun is. I think your player is maybe holding the gun inside the body…