I want to have a button in my level . Whenever player clicks the button camera angle changes when he click for second time camera will again change to 3rd angle . Can anyone help me out . Any help is appreciated
Please help me
Hi Dipesh1510
Assuming the camera is inside your player pawn / character. You can access the player pawn / character using the GetPlayerPawn function.
Inside your player pawn add your logic to change the camera angle.
Then inside your widget, call that function on button click.
This is a very simple solution, I am not sure if you’re looking for something more complicated?
Hope this helps.
Alex
Buddy what’s the name of that ++ byte key in increment camera angle index
Ok buddy .
Bro please show your setup of the cameras in viewport .
When I press the button camera angle doesn’t changes but instead get zoomed . Why is this so happening ?
That’s because you never specified any details so Alekann01 provided, quite understandably, a very generic solution.
In your case, the camera is attached to a springarm so you want to rotate the springarm, not the camera. Don’t forget to put the actual rotator values of the desired angles. Currently it all reads 0.
- use Springarm instead of Camera
- put numbers that you want in NewRotation
I don’t have the blueprint, we’re 2 different people.
have a look at my setup
Buddy plz show the blueprint of what you are saying as I’m preety new to ue4
Sorry buddy for not specifying details
Hi Dipesh1510
Looking at your screenshots, it appears you are trying to use multiple cameras. The solution I proposed is designed for one camera.
In the screenshot of my pawn, you can see I am setting the relative position and rotation of the Camera component. As Everynone has mentioned, you need to change this to set relative rotation for the spring arm component instead.
Make sure you actually specify different rotations. If you leave it 0 0 0 (like I did), it will always reset to 0 0 0.
Unfortunately, I do not have the blueprints as I deleted them once I created that basic solution. However, you should have enough information here to resolve your issue.
Thanks for the clarifications Everynone <3
Hope this helps.
Alex
This is a better solution than mine for using the spring arm component.
My solution is to manually position the camera to specific locations / rotations.
Here’s another simplistic approach:
- the ball pawn:
- its widget
But this will need more work. At this point, I’m not sure what you need so this is also quite generic.
Whenever player clicks the button
camera angle changes when he click for
second time camera will again change
to 3rd angle
Technically, yours is more suited for what OP stated, though! If the angles are predefined, I’d go with yours. I just saw Dipesh1510’s other threads so I made an assumption. Not too sure what the real end goal here
Thanks buddy this works . Now whenever I clicks the button angle changes . But If I again clicks the button camera angle doesn’t changes to the first one . How to make that
Not anymore, it was disabled a couple of months ago or so. It was actually a useful feature.
Yeah, it entirely depends on the purpose.
Are you able to see users question history and profile? I used to be able to, but recently I get “permission denied”?