Page 1 of 1
How can i make a dialogue system similar to Genshin Impact
Posted: Tue May 14, 2024 3:41 am
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?
Re: How can i make a dialogue system similar to Genshin Impact
Posted: Tue May 14, 2024 8:12 am
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.