Skip to main content
GameDev.net gamedev.net
🔒 Locked

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

Started by Tracker610 Feb 28, 2025 at 6:24 PM 4 replies 3.5k views
Original Post
Tracker610
Tracker610

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

None
hplus0603
hplus0603

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 };
Alberth
Alberth

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.

flatingofamily
flatingofamily

@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

None

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.