How can i make a dialogue system similar to Genshin Impact

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
RAG
Posts: 1
Joined: Tue May 14, 2024 3:29 am

How can i make a dialogue system similar to Genshin Impact

Post by RAG »

I am trying to make a dialogue conversations like the one in genshin impact. I believe that they calculate the distance between the player and the npc are talking and create a pivot point between them that camera can rotate around that pivot point. How can i replicate this?
Image
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: How can i make a dialogue system similar to Genshin Impact

Post by Tony Li »

I'm guessing that Genshin Impact may be using Cinemachine. You can set up a Cinemahcine vcam that frames the characters involved in the conversation. If you want to do it yourself, in an OnConversationStart(Transform) method you could place an empty GameObject between the two participants and move the camera there. Simple example:

Code: Select all

public Transform focalPoint; //<-- GameObject to move camera to. Assign in inspector.

void OnConversationStart(Transform actor)
{
    focalPoint.position = (DialogueManager.currentActor.position + DialogueManager.currentConversant.position) / 2;
}
In the first dialogue entry, use a sequencer command such as: Camera(Wide, focalPoint, 1)@0.1

This will wait 0.1 seconds (to allow the code above to set focalPoint's position) then move the camera to a Wide shot of that point.
Post Reply