Advertisement

Can you tell me how to make a chat in the unity? So that when a person speaks, his mouth opens.

Started by February 28, 2025 06:24 PM
4 comments, last by flatingofamily 23 hours, 36 minutes ago

Because I can't find anything on the Internet about mouth opening when using chat rooms.

None

In your head model, build a morph target that opens the mouth.

In your sound system, tap into the voice stream for the player and get the stream of sound samples.

Calculate the average value of the sound samples for the last 30 milliseconds for each frame, and drive the morph target some amount proportional to this average, clipped to some maximum (e g, you might want to say that any average loudness larger than 0.1 will count as “max” anyway, so you drive the morph target with the value min(max(loudness*10, 0))

enum Bool { True, False, FileNotFound };
Advertisement

@hplus0603 Thank you very much.

None

Tracker610 said:
Because I can't find anything on the Internet about mouth opening when using chat rooms.

It seems you're too much looking for the complete solution.

Instead, break the problem down into smaller parts, and solve each individual problem.

Eg “moving mouth” and “calculate amount of sound from chat” are much smaller problems and much more likely to be discussed.

@Tracker610 man, you’ll need a chat system + lip sync. For the chat, use Unity’s UI + networking (Mirror, Photon, etc.). For the mouth animation, simplest way is to use blend shapes (if using a 3D model) or sprite swapping (for 2D).

Sync it by detecting when a player types/speaks and triggering the animation. If using voice, check Unity’s Microphone API + amplitude detection to animate based on volume. Quick and dirty, but it works

Advertisement