Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

795
Vistas
Unity3D Cinemachine - How can I lock onto an enemy dark souls style?

I'm working on a small experimental project in Unity, and I want to lock on to an enemy. My camera behaves similar to Dark Souls camera, by using Cinemachine Free Look camera. Now I want to be able to click a button, and lock onto the enemy, similar to how the dark souls camera works, displayed in this video. I also made an image to explain what I'm looking for. I want both the player and the enemy be in the vertical center of the screen while locked on, but I want the camera to follow the player, while rotating around the enemy basically.

I have tried to add both the player and the enemy in a target group, but it doesn't behave the way I want it to. Sure, it looks at both the player and the enemy but it doesn't keep them aligned like I have tried to show in the image and the video.

Image describing the goal

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

To me in the video it looks like the camera is positioned around a pivot point (green) that is fixed to the player. The camera then points to the exact middle position (orange point) between the player and the selected enemy. It also looks like there is an max angle when the enemy jumps.

Illustation

A quick proof of concept with the code I made. However the code is really just a proof of concept:

Quick mock

public class CameraScript : MonoBehaviour
{
    public Transform enemy;
    public Transform player;
    public float cameraSlack;
    public float cameraDistance;

    private Vector3 pivotPoint;

    void Start()
    {
        pivotPoint = transform.position;
    }

    void Update()
    {
        Vector3 current = pivotPoint;
        Vector3 target = player.transform.position + Vector3.up;
        pivotPoint = Vector3.MoveTowards(current, target, Vector3.Distance(current, target) * cameraSlack);

        transform.position = pivotPoint;
        transform.LookAt((enemy.position + player.position) / 2);
        transform.position -= transform.forward * cameraDistance;
    }
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda