How do you keep the camera from flipping during car crash?

Hey everyone! I’m working with the Advanced Vehicle default project, and when my vehicle flips, the camera flips with it (speaking of the 3rd person perspective). How can I lock in the camera’s pitch and roll so that the only rotational movement it’s allowed to do is around the z-axis? (I’m trying to have a more “true” 3rd person feel instead of just a first-person feel that’s been pushed back a few meters) This would also help me with the issue of the camera going under the ground when the car flips over.

Hey @aNorthStar! This is great!! I think I’m going to end up doing a combination of your two methods! I ended up just leaving Inherit Yaw checked, and that got me 90% of the behavior that I was looking for! The other 10% is when the car goes around the loopty-loop, at that point I DO want the camera to follow the vehicle’s pitch. I’m thinking I’ll add a bool to the vehicle blueprint, detect when the vehicle is on a loop, and if it is, in the tick function I’ll use your second method to update the pitch until the vehicle is OFF the loop. I’m gonna go ahead and accept this answer, as I think what you’ve provided perfectly answers my question. Thanks!!

There seems to be a bug with Anserhub…there is no accept button. I will check back regularly until I can accept your answer

Automatic - if you are using an automatic SpringArm and Camera setup, the first thing I’d suggest is to untick Inherit Pitch and Roll (leaving Inherit Yaw on) in your SpringArm settings… maybe post a screenshot of your BP and let’s see how your camera is handled? With this setup though, yaw is likely to flip awkwardly when your vehicle rolls end over end. You might try switching off InheritYaw with a Branch in this situation (though I’m not sure what the SpringArm will rotate to when it’s freed, it just might be 0 degrees world yaw)

Manual - If you are manually rotating your Spring Arm, with something like InheritPitch/Yaw/Roll set to off, UseAbsoluteRotation on your SpringArm once in BeginPlay and then doing RinterpTo on Tick… I think it would be easier to control. The attached is a simple setup… again, I’d use something like a Branch, so when your vehicle roll exceeds +80 degrees the SpringArm simply stops rotation. You can use an Finterp or Timeline Alpha plugged into the to smooth the stop and start of the camera…

thank you! I just converted the comment to an answer :slight_smile: