Moving Camera On the fly

So I am trying to move my camera to a socket created on a rifle

I have been able to print out the sockets location

But i have no idea how to move my camera to the socket and follow it

I am trying from my base player controller

this is what I am trying to do but am really lost SEE FORUM LINK HERE

Maybe with set relative location?

@unit23

Maybe… but thing is i cant access the data! How would i get the data into or from the player controller?

If you access a player controller, make a Cast to PlayerControllerName, with Get Controller, then a node for Set Relative Location.

I did try that, but i get the following Cast will always fail error

Use a key input on your event graph, seems you fixed the object error.

one step ahead of you!

All it prints is x y and z at 0.0

And the same here

I see that Sight is a variable in both your gun blueprint and your character controller.

It looks that Sight is never assigned in your character controller, hence the None error.

Does your player controller own a reference to your gun blueprint? If so, you would use that reference variable and then get the Sight variable from the gun blueprint.

Ok so created a Vector called SightLocation in the assault rifles blueprint and made it public…
I fed in the Sights Relative Location to the Variable (which is containing the data)

I tried to pic the variable up from the player controller but i cant

This is starting to drive me a bit bonkers

On that Error node, it is trying to get a Sight Location variable owned by BasePlayerController, but it is actually part of AR_Blueprint. Therefore in BasePlayerController, you need a variable that holds a reference to AR_Blueprint.

How do you attach your gun to your character? Do you spawn an actor based on AR_Blueprint?

This is how its done

I created the AR Ref but it didnt help

See that return value from spawn actor for AR_Blueprint. Plug that into a Set for Ar Ref.

AHHHHHHHHHHHHHHH

Love you man! Thanks alot!!!

Well great that i got the sockets location but now when i try to use it it goes about 20ft into the air!!

Whats up with that? You can see the socket at the top of this thread

Its supposed to attach the camera to the socket placed just on the weapons iron sight, but it ends up up here instead

What is the name of the socket you created on the gun? I think you have to put that socket name in the In Socket Name part on the get socket location.

I tried that… put the name in, camera moves just a touch forward so i thought “Ahh ok, im moving the camera but the boom is still the same” so i set the boom to 0 and the camera went up my guys ***!

God dam this S*1ts hard!!!

I dunno

Im sure i get the concept of what i want to do but how to do it is killing me

If your camera has a boom, that is what you want to place in the gun socket, since the camera is a child of the boom, the camera will move appropriately if you move the boom. Then if you want the camera right on the spot, you would set the Arm Length of the boom to 0.

I’m assuming your weapon has a skeletal mesh component? If so, on the Get Socket Location, you actually want to put the target as the weapon’s skeletal mesh component, not that Sight variable. And then it will find the socket on the gun mesh.

Well I finally got it done!!!

To everyone who helped me both on this and my other thread (where i wanted to explode my computer and never hear the name UE again), I give a HUGE thank you to you… @ToxinGaming patient life saver!

Well, until I get stuck again, (I expect in about 3 mins), cheers for now and again thank you!

I’m glad you were able to get that done. Next you’ll probably want to make sure that left hand is locked onto the rifle. Information on how to do that located here.