0
\$\begingroup\$

This is a problem that seems to have no reasonable answer anywhere around, yet is a commonly needed aspect of developing game mechanics.


Context

I'm developing a traditional 3rd person character controller esque thing, you know, camera controlled by mouse/joystick all that jazz.

The issue comes when I'm developing a climbing system:

  • I have to develop a climbing system, and when I 'attach' the player to a climbing ledge, they could be at any angle relative to this ledge, up to perpendicular.

  • When the player jumps up, and the ledge detection runs, the player attaches to the ledge, and needs to rotate to be facing the ledge dead on.

  • I need a method for the camera movement to be completely independent of this capsule collider rotation change, as currently I have this problem:...


Problem

When I rotate my player's capsule collider, the attached camera boom rotates with it.


Specific Problem

When I set my actor's rotation directly, the camera orients itself immediately with the player's direction, then immediately returns itself to the previous view, creating a massive camera jitter, especially at lower framerates.


The question

How do I prevent this behaviour

OR

How do I reapproach problems of rotating the player character?

\$\endgroup\$
5
  • \$\begingroup\$ I don’t get why the camera returns back to the previous direction ? \$\endgroup\$ Feb 4, 2020 at 18:07
  • \$\begingroup\$ If I understand correctly you dont want the camera to rotate with the pawns capsule - then you can mark camera component (what ever is holding it actually) rotation to world space (as opposed to relative). \$\endgroup\$ Feb 4, 2020 at 18:12
  • \$\begingroup\$ @ColdSteel Yeah I don't get it either. Hm, I'll try setting the camera component to world space just before I set the player rotation, and then set it back afterwards. If that doesn't work, I'll try posting a few videos of what happens \$\endgroup\$
    – Natalo77
    Feb 5, 2020 at 9:18
  • \$\begingroup\$ why would you set it back ? If you want the camera not rotating with the player, then use the camera in worldspace :-? \$\endgroup\$ Feb 5, 2020 at 9:50
  • \$\begingroup\$ @ColdSteel Ah. I need to provide a little more context, see the post edit above \$\endgroup\$
    – Natalo77
    Feb 5, 2020 at 10:38

1 Answer 1

1
\$\begingroup\$

I've had the same problem, and as @natalo77 said in the comments, switching to absolute rotation did the trick.

You need to select the parent of your camera (the camera boom), then in the transform, for the rotation, select "absolute rotation" for the rotation instead of "relative".

I kept the position vector at "location" so that the camera moves with the player.

then I guess you can use the "look at" function bewteew the camera and capsule to keep the player at the center of the screen.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .