1 (edited by anjumshehzad316 2021-02-18 08:02:00)

Topic: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

When player 1 switches side by jumping over the opponent, there is a camera glitch. This happens only if player 1 jumps
Player 2 jump works fine
Video : https://drive.google.com/file/d/1Wq5Ey2 … sp=sharing

Share

Thumbs up Thumbs down

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

I noticed that too, but could not figure out what was causing it before release. Will see if I figure this issue on the next update.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.
Don't forget to check our discord channel.

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Any idea when that update will release?

Share

Thumbs up Thumbs down

4 (edited by skyflare 2021-03-07 20:02:12)

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

I just updated to latest UFE 2 from asset store, and see that you've added a better allow airborne side switch behavior for the 3d fighter, great!.  but then I see this jerky camera behavior.  I started debugging this and found that jumping from left side to right side, this code fixes it:

CODE REMOVED BECAUSE IT WAS WRONG APPROACH

Now I have to figure out why jumping from right to left still has the problem.  I'm also a bit confused about how the dollyTransform needs to lookat the character instead of a point between the characters, but maybe that is ok.

I also seem to be able to run through the character and cause mirror to reverse without jumping when I'm near the character with ground collision mass set to 0.5 and scale 1 for character prefab.  There may be accuracy problems with how mirror gets tested and set in ControlsScript.   I think the accuracy or timing of when that gets set might result in a fix for the camera.

Perhaps the character is landing for a frame or two not rotated to the correct facing direction yet and the camera is trying to do a 180 rotation for a couple frames, but then it goes back to the correct position right away when the character is facing the correct way after changing mirror property.

Share

Thumbs up +1 Thumbs down

5 (edited by skyflare 2021-03-07 14:21:31)

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Also, when you are jumping, it feels like the math/logic is such that the camera moves faster when you land like some of the camera movement logic is not always running every frame.    I haven't isolated this behavior yet, but it would make more sense to me for the camera to be smoothly lerping while you are in the air, so that the landing doesn't cause a sharp correction to the zoom/camera position.  Jump forward/back when not near the opponent is not very smooth currently.   I may try to figure out this problem as well.

Share

Thumbs up Thumbs down

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Hi,

I was able to fix all the 3d camera problems I found and I sent the changes I made to mistermind in private message.

I tried so many other things, I spent most of the day on this stuff, since it wasn't easy for me.   I was able to visualize that the camera target position was an inaccurate vector, the logic was wrong for entering this function leading to jerky camera movements on the jumps and the calculation to determine which character is on which side of the screen was briefly wrong, and needed to be added to the camera code in order to detect that properly.

Share

Thumbs up Thumbs down

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

@skyflare Can you share source code.I really need quick fix

Share

Thumbs up +1 Thumbs down

8 (edited by Storm87 2021-04-13 13:06:12)

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Mastermind could you share the code with us, if you dont mind.

Share

Thumbs up Thumbs down

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

These are the messages he sent me:

skyflare wrote:

Hi,

Regarding this thread, I spent some time debugging the camera in latest ufe 2 release in 3d fighter, and found this as a possible solution.  I may make some other changes, since there are still some zooming issues when jumping near opponent.


in DoFixedUpdate of CameraScript.cs

                    // UFE.config.characterRotationOptions.allowAirBorneSideSwitch needs to be true instead of false here
                    if ((UFE.config.characterRotationOptions.allowAirBorneSideSwitch || (player1.Physics.IsGrounded() && player2.Physics.IsGrounded())) &&
                        (player1.currentMove == null || !player1.currentMove.allowSideSwitch) &&
                        (player2.currentMove == null || !player2.currentMove.allowSideSwitch))
                        Update3DPosition();




and the top of this function changes to:


        public void Update3DPosition()
        {
            if (dollyTransform == null) return;
            // Update dolly transform to center around the 2 characters
            Vector3 dollyPos = Vector3.zero;

            Vector3 leftPlayerPos = player1.transform.position;
            Vector3 rightPlayerPos = player2.transform.position;
           
            // we need to calculate this here, instead of relying on mirror, because mirror is wrong sometimes
            var myX = Camera.main.transform.InverseTransformDirection(leftPlayerPos - Camera.main.transform.position).x;
            var opX = Camera.main.transform.InverseTransformDirection(rightPlayerPos - Camera.main.transform.position).x;
            if (myX > opX)
            {
            // if (player1.mirror > 0)
            // {
                leftPlayerPos = player2.transform.position;
                rightPlayerPos = player1.transform.position;
            }

            dollyPos = ((leftPlayerPos + rightPlayerPos) / 2) + new Vector3(0, UFE.config.cameraOptions.height3d, 0);
            dollyTransform.position = dollyPos + dollyTransform.forward;
            dollyTransform.LookAt(rightPlayerPos);

skyflare wrote:

Hi,

At certain camera settings, there is a horrible thrashing of camera position when the dollyPos value is very small when the characters are near.  I was able to debug it better by changing the frame rate to be very slow.  I also made a cube position itself at the dollyTransform position and rotation to understand how it works and I saw that it was inaccurate when forward is used leading to it becoming negative values instead of centered.

I found the jump, zoom and camera thrashing problems are fixed by changing it to this:

            dollyTransform.position = dollyPos;//+ dollyTransform.forward;

In addition to the changes in the previous message to fix all these 3d camera issues.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.
Don't forget to check our discord channel.

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Worked like a charm.Thanks

Share

Thumbs up +1 Thumbs down

11 (edited by BlankMauser 2021-05-10 13:07:24)

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Does anyone else use this code?

I tried it, and it DOES fix the camera issues. However, attack physics don't get mirrored afterwards.

Example, my x forces don't get mirrored once I jump to the right side, so all my attacks push the opponent towards me instead of away.

Share

Thumbs up Thumbs down

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Under Global -> Character Rotation Options, try toggling "Fix Rotation When Stunned".
The character will automatically rotate towards the attacker and the relative force will apply in the correct direction.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.
Don't forget to check our discord channel.

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

Mistermind wrote:

Under Global -> Character Rotation Options, try toggling "Fix Rotation When Stunned".
The character will automatically rotate towards the attacker and the relative force will apply in the correct direction.

This is very very close to being perfect, however there is still one lingering issue. When I have moves that airborne side switch, such as an airdash or super jump, the X Force keeps flipping me back and forth. This does not happen during a regular move like jump.

I tried turning off "Always Face Opponent" but that seems to mess up the controls really badly on side switch.

Share

Thumbs up Thumbs down

Re: Player 1 jump side switch camera glitch (UFE 2.4.0 Source)

For anyone who still needs this, I did a work-around fix like this:

    public void OnMove (MoveInfo move, ControlsScript player)
    {
        if (move.moveName == "Super Jump")
        {
            player.Physics.currentAirJumps++;
        }
    }

Every move that is a "Jump" must have this property.

Share

Thumbs up +1 Thumbs down