Stop camera from following

I’m trying to make my character float to the heavens, setting its Alpha to 0.5, but I’m having trouble stopping my camera from moving. And somehow when it is following my character, the Z-axis gets involved. See the end of the GIF, where you can see everything getting skewered.
I created a Death Camera in the State Driven Camera setup and connected it, but I can’t figure out how to stop it from following.

How do I get to stop the camera from following the player when they die?

My code for floating upwards is this:

// Floating upward
Vector2 floatingUpwardSpeed = new Vector2 (0f, 2f);
rb.velocity += floatingUpwardSpeed;

// Stabilize horizontal movement
Vector2 stabilize = new Vector2 (0f, rb.velocity.y);
rb.velocity = stabilize;

I want the player to float upwards in a straight line, which doesn’t work as well. Maybe I’m doing something wrong in that code, which makes the camera go weird.

Tilevania_death_animation_-_Trim_AdobeExpress

Remove the player from the death camera’s follow target

I tried that, but than it goes back to the starting position of the camera at the beginning of the level.

A simple - but hacky - solution:

  • Add a game object to your character, call it Death Cam Target (or whatever you want, really)
  • Set that as the death camera target.
  • Grab a reference to this object and when the character dies, set its parent to null.

This will have the camera follow the game object until the character dies. Then it will leave that target right there where the character died

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms