Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

800
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!