camera problem

Hi!how to bind camera at the head of the driver and rotate it over the sides of car’s cabin? that is to say, to make view on 180 degrees from first-person with using the mouse. please help))

Hello Vladi_Sh

There are several steps to create what you need!

  1. Go to Project Settings > Input > Axis Mappings > +
    (This is what the camera will use to rotate when inside the vehicle, and I have named mine LookRight)
  2. Add a camera to your character or vehicle that will be on the inside
  3. Open the Event Graph for that character or vehicle
  4. Set up How your Cameras will switch and a variable set to true when you in your inner camera (I used the R Key in Screenshot_01)
  5. Get an Even Tick Node and set 3 branches your first branch will check for the inner camera variable (we will come back to the other two in a second)
  6. Get your inner camera and from it get its relative rotation,
  7. get a break the rotator from the relative rotation and then pull off of the Z axis and get a Float + Float
  8. Now use the custom axis mapping we made earlier (Mine is named LookRight) to add to the Z axis float
  9. Pull off of that value and clamp it (min should be -90 and max should be 90 for the 180 degree effect you specified in the question)
  10. take the clamp and put it into a make rotator via the Z axis
  11. The return value plugs into a set Relative rotation that is gotten from a reference of the inner camera
  12. Go back to the float + float node and pull off and get a float >= node and set the second value to 90 (This is to stop the camera from auto flipping to the min if you passed the clamp values)
  13. Connect the Bool value from the >= into the second branch
  14. Go back to the float + float node and pull off and get a float <= node and set the second value to -90 (This is to stop the camera from auto flipping to the max if you passed the clamp values)
  15. Connect the Bool value from the >= into the third branch

Your end result will look something like Screenshot_02

Hope this helps!

it works!thanks! but camera stays in the place when car turns. how to do that camera will turn in the motion side when car turns? how i can add the car`s rotation to camera?

So your camera is following the vehicle, but your camera is setting a custom rotation, so even when the vehicle turns, the camera maintains its custom rotation. To have it follow the car you will have to reset the camera back to the front of the vehicle.