Loading...
52
1 year ago

!!!SLIGHT VOLUME WARNING!!!

got bored earlier and had an Idea to make a marble game but the velocity is controlled by your Microphone Input It moves in the direction you look at when you talk / scream / blow air into your mic.

v Explanation in Article v


It might sound like something That'd be complicated to do but no lol

The player is just a RigidBody3D, set up in a way I felt best.

for the camera, the player has a child node called "CamGymbal" which holds the Camera (so you can move the camera from left to right, I didn't add looking up and down because I felt it was better that way)

image.png

CamGymbal has "Top Level" on, which makes it not follow its parent's position (which is the player) this is to prevent it from rotating along with the ball. We put the Gymbal to the Player position in code.

The Level layout is pretty simple to make, it just uses a Path3D with a CSGPolygon3D as a child node, which I connected to the path so the CSG Follows along the path.

This is what the CSGPolygon3D Looks like:

image.png

And this is how the Path3D works.

image.png

These were my CSGPolygon3D Configurations:

image.png

For code, It's pretty simple.

image.png

MicIdx is the Audio Bus Index for the Microphone Input

I added a "Mic" bus with the "Record" Filter, then connected it to "MicMute", which is a muted track.

This is to prevent the Microphone Input from being played back to you.

image.png

I then have an AudioStreamPlayer in the Scene set up like so:

image.png

Under _ready():

image.png

we set the mouse to be Captured to the Window.

AudioServer.get_input_device_list()[2]is my manual Implementation of setting the Input device to the correct Microphone lol.

get_input_device_list() returns a PackedStringArray

a Finished game would obviously put this in the Options or something but for Testing purposes I just did it manually

The line below it then sets the Microphone Input to the Device.

Under physics_process():

image.png

we set the Camera Gymbal's position to the Player's position so the Camera follows the player.

then we get the peak volume of the mic track using the MicIdx we got earlier.

peak volume basically means your microphone volume, since we have a "Record" filter on the bus.

in that same line, we also remap from -50 and 0 to 0 and 10

that means -50 is now 0 and 0 is now 10

-50 is the quietest I've seen my mic go, although it turns to -200 when turned off, no difference, since it caps the minimum to 0.

and 0 is the max input volume, so the loudest you can be.

If Sample is more than or equal to 3 (this is so it doesn't detect random noise, obviously a finished game would have all of this customizable in the options but this is just a test)

we -= the linear velocity of the player to the CamGymbal's global basis z, which is basically rotation to facing or something. Idk I suck at all this math vector stuff.

we divide that Initial Vector3 by 20 to make it wayy slower, then times that by Sample, which again. is our volume.

Under _input(event):

image.png

we check if event is InputEventMouseMotion and then rotate the Gymbal's y to -event.relative.x * 0.003 (we times that by 0.003 to make it slower)

Sable Gif:



2 comments

Loading...

Next up

Don't miss out on the #WitchspireArt competition!

To celebrate Witchspire's demo launch, Envar Games want to see your Witchspire fan art. Enter to win an Amazon gift card!

Complete our quest to enter.

Learn more: https://bit.ly/WitchspireArtCompetition

Happy Devruary! Devruary Day 20 celebrates @LilianDuleroux ! They're the artist, writer, and game dev behind The Voyage Sinister! We also have a question for the devs of Game Jolt: What advice would you give a new dev?

Witchspire is a survival-crafting adventure in a world brimming with magic and peril.

Befriend and battle creatures, and conjure up a sanctuary alongside other witches in co-op or single-player.

Try the Next Fest demo: https://bit.ly/WitchspireSteam

"Thanks guys for endless hours of fun." ๐Ÿ‘

(My first fan art. Read the article, please.)

#sonic #mario #photoshop

"Our work is never over" they said.

Strange Umbrella

Hi everyone! I started to create some environment props for my new video game, here is a cozy house in the forest. I'm planning to switch from Unity to Unreal... Let's see what new challenges I have to face. Made in Blender and Substance Painter.

A house I've built a while ago. :)

It nicely separates the snowy biome from the grassy one.

It's built with painted Ebonstone.

Call it 'wrong turn'!๐Ÿšซ The feeling of running into a house with only one exit๐Ÿšช, and being doomed to die. #pixelart #pixelartist #pixelartwork #art #pixel #indiegame #IndieGameDev #indieartist

Spaaaace~

These are background sprites I've created for a game I'm working on at school ^w^ Click on the post to see how the sprites connect. You won't regret it! (personally, I think it's pretty heheh)

Drawn in Piskel using my mouse. Whaddya think?