Topic: Hide opponent during cinematic intro

I was wondering how could i hide the opponent during the cinematic intro of my character, and for p2 as well, as in my intros sometimes camera angles conflict with the characters, or they are already in the fight, and then in their intros the come from somewhere beyond the screen, and it looks a little funny.

Thanks!!

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Hide opponent during cinematic intro

I'm thinking of a combination of 'Opponent Override' and 'Body Parts Visibility Changes'. Perhaps assigning the 'Root' Body Part to the parent gameobject and set an override from the Intro Move itself.
I haven't tested this yet, but in theory it should work without the need to code.

Like UFE? Please rate and review us on the Asset Store!
Questions about the Forum? Check out our Karma FAQ.

Re: Hide opponent during cinematic intro

Hello StriderSpinel.

I had the same problem during intros and outros in our game-project.
Here is my solution:

The idea is to create an additional layer which is not visible for the game-camera. During runtime you can move any gameobject (and it's children) to this layer to make them temporary invisible.

So at first create a new layer called "invisible" (layer #13 in my case):

https://i.ibb.co/M9tRHtW/invis-01.jpg


Now setup the camera's culling mask to all layers except the new layer ("invisible" = 13).
https://i.ibb.co/7jTHf5M/invis-02.jpg

Now you only have to move gameobjects to or from this layer.


Here is my solution for the intro-animation:

Open ControlScript.cs and add before

public void DoFixedUpdate( .... 

this code:

void SetLayerRecursively(GameObject obj, int newLayer)
    {
        if (null == obj) return;
        obj.layer = newLayer;
        foreach (Transform child in obj.transform)
        {
            if (null == child) continue;
            SetLayerRecursively(child.gameObject, newLayer);
        }
    }

This moves a gameobject and its children to a new layer.


Now change this:

else if (currentMove == null && ((playerNum == 1 && !introPlayed) || (playerNum == 2 && !introPlayed && opControlsScript.introPlayed))) {
            CastMove(myMoveSetScript.intro, true, true, false);
        }

to this:

  else if (currentMove == null && ((playerNum == 1 && !introPlayed) || (playerNum == 2 && !introPlayed && opControlsScript.introPlayed))) {
            CastMove(myMoveSetScript.intro, true, true, false);
            SetLayerRecursively(opControlsScript.gameObject, 13); // hide opponent during intro
        }

and to make the opponent visible again at the end of the intro-animation,
change this:

        // Kill Move
        if (move.currentFrame >= move.totalFrames) {
            if (move.name == "Intro") {
                introPlayed = true;
                if (opControlsScript.introPlayed) UFE.CastNewRound(2);
            }

to this:

        // Kill Move
        if (move.currentFrame >= move.totalFrames) {
            if (move.name == "Intro") {
                introPlayed = true;
                SetLayerRecursively(opControlsScript.gameObject, 9); //make opponent visible after intro
                if (opControlsScript.introPlayed) UFE.CastNewRound(2);
            }

That's my solution and it worked for our game so far.

best regards,
shubi

shubi's Website

Share

Thumbs up +2 Thumbs down

Re: Hide opponent during cinematic intro

Amazing! Tomorrow morning gonna check it!

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

Re: Hide opponent during cinematic intro

Works perfectly! Thanks!!

Me encontraste en un negro camino como un peregrino sin rumbo ni fe, pero la luz de tus ojos divinos cambió mi suerte por dicha y placer.

6 (edited by eldiablo 2023-02-06 07:46:41)

Re: Hide opponent during cinematic intro

shubi wrote:

Hello StriderSpinel.

I had the same problem during intros and outros in our game-project.
Here is my solution:

Does this work on UFE2? can't find those..
UPD: it really works! got some difficulties in finding all the lines but now it's good.

Share

Thumbs up Thumbs down