How to create the motor sound for a car game (Godot 4)

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ม.ค. 2025
  • In this video I'll show you how to mix three sine waves to create the motor sound.
    Credits:
    "Low Poly Car - Chrysler Saratoga 1960" (skfb.ly/o87Ow) by ROH3D is licensed under Creative Commons Attribution (creativecommons....
    "CCity Building Set 1" (skfb.ly/LpSC) by Neberkenezer is licensed under Creative Commons Attribution (creativecommons....
    www.audacityte...
    godotengine.org/
    fonts.google.com/
    obsproject.com/
    www.shotcut.org/

ความคิดเห็น •

  • @PavltheRobot
    @PavltheRobot ปีที่แล้ว +12

    Game looks cool, reminds me of old Driver games from PS1

  • @Kiousax
    @Kiousax 10 หลายเดือนก่อน +1

    THANKS I GIVE YOU A HUGE LIKE

  • @peacefusion
    @peacefusion ปีที่แล้ว +3

    really nice demo man

  • @Red_Spirit11
    @Red_Spirit11 ปีที่แล้ว +3

    1960 Chrysler 300 nice choice of car

  • @Big_Theft_Auto
    @Big_Theft_Auto 5 หลายเดือนก่อน +1

    It is remarkable how good the car sounds at the end when I realized that the only sound that you used was a round sinewave.
    I have an observations about the controls, in a normal car, you would gain more grip when you release the throttle but in your Game It feels weird because It looks like you lose some grip when youre not throtteing. But everything else is very good job
    I subscribed to your Channel

    • @tomaga4995
      @tomaga4995  5 หลายเดือนก่อน

      Thanks! In terms of sound this is no coincidence, reference is Fourier synthesis. However exceeding the signal limits also plays a role here.

    • @Big_Theft_Auto
      @Big_Theft_Auto 5 หลายเดือนก่อน +1

      I would like to learn to code engine sounds into my game, is there a tutorial for Godot that you recommend?

    • @tomaga4995
      @tomaga4995  5 หลายเดือนก่อน

      @@Big_Theft_Auto I was just using the documentation (it is good!). I'm using two AudioStreamPlayer3D nodes. One for accelerating and one for decelerating. I use the same pitch (pitch_scale) for both of them. The pitch depends on the speed of the car. The volume (volume_db) is different for accelerating and decelerating. When accelerating the on-sound is loud and the off-sound is quiet and vice versa. Very simple.

    • @Big_Theft_Auto
      @Big_Theft_Auto 5 หลายเดือนก่อน +1

      @@tomaga4995 clever stuff, i'm going to try but with a recording of a real engine and see if it sounds as good, if it doesn't then i'll just do exactly what you did 😅 😂

  • @FarhanAkbarnezhad-hu5gq
    @FarhanAkbarnezhad-hu5gq 9 หลายเดือนก่อน +1

    Nice

  • @EeVeE3D
    @EeVeE3D 5 หลายเดือนก่อน +1

    Nice tutorial

    • @tomaga4995
      @tomaga4995  5 หลายเดือนก่อน

      Thank you!

  • @MethanicBlast
    @MethanicBlast 10 หลายเดือนก่อน +1

    Thanks for sharing.

  • @eagle4226
    @eagle4226 11 หลายเดือนก่อน +1

    good tutorial + hitting the best drifts haha good job man

    • @tomaga4995
      @tomaga4995  11 หลายเดือนก่อน

      Thank you!

  • @SOS_Studios
    @SOS_Studios 10 หลายเดือนก่อน +3

    how to i get the sounds to play?? not much of a tutorial for godot, mainly just audacity 😞

    • @SOS_Studios
      @SOS_Studios 10 หลายเดือนก่อน +2

      i just made my own, not as good as the one in the video but it works!
      (you must use a VehicleBody3D node)
      extends VehicleBody3D
      const MAX_STEER = 0.8
      const ENGINE_POWER = 500
      const MAX_SPEED = 100 # Adjust MAX_SPEED according to your needs
      @onready var camera_pivot = $CameraPivot
      @onready var camera_3d = $CameraPivot/Camera3D
      @onready var reverse_camera = $CameraPivot/ReverseCamera
      var look_at
      var engine_sound_player : AudioStreamPlayer3D
      func _ready():
      Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
      look_at = global_position
      engine_sound_player = $CameraPivot/AudioStreamPlayer3D2
      engine_sound_player.play()
      func _physics_process(delta):
      steering = move_toward(steering, Input.get_axis("ui_right", "ui_left") * MAX_STEER, delta * 3.5)
      engine_force = Input.get_axis("ui_down", "ui_up") * ENGINE_POWER
      # Adjust these parameters for faster and higher pitch increase
      var pitch_increase_speed = 5.0
      var max_pitch = 10.0
      # Calculate engine sound with faster and higher pitch increase
      var engine_sound = linear_velocity.length() / MAX_SPEED * pitch_increase_speed + 1
      engine_sound = min(engine_sound, max_pitch)
      engine_sound_player.pitch_scale = engine_sound
      camera_pivot.global_position = camera_pivot.global_position.lerp(global_position, delta * 20.0)
      camera_pivot.transform = camera_pivot.transform.interpolate_with(transform, delta * 5.0)
      look_at = look_at.lerp(global_position + linear_velocity, delta * 5.0)
      camera_3d.look_at(look_at)
      reverse_camera.look_at(look_at)
      _check_camera_switch()
      func _check_camera_switch():
      if linear_velocity.dot(transform.basis.z) > -2:
      camera_3d.current = true
      else:
      reverse_camera.current = true

    • @TemmieCW
      @TemmieCW 6 หลายเดือนก่อน

      @@SOS_Studios Great code! Thanks for the help!

    • @krttikeya
      @krttikeya 4 หลายเดือนก่อน

      @@SOS_Studios thank you

  • @DaDiDu_OS
    @DaDiDu_OS 11 หลายเดือนก่อน +4

    car script tutorial

  • @gos994
    @gos994 ปีที่แล้ว +1

    A turioal on how to make the buildings?

    • @tomaga4995
      @tomaga4995  ปีที่แล้ว +1

      I didn't make them myself. They are from sketchfab (link in the description). I then simply placed a few of them next to each other.

  • @magco80
    @magco80 ปีที่แล้ว +2

    great job, but the car feels very slipery right? it shoudn drift that much lol

    • @IPlayKindred
      @IPlayKindred ปีที่แล้ว +3

      Heavy 50s cars kinda do that to some extent tbh xD

  • @user-zi8wd3ov8m
    @user-zi8wd3ov8m 6 หลายเดือนก่อน

    how did u code the sounds to the car?

    • @tomaga4995
      @tomaga4995  6 หลายเดือนก่อน +1

      I've created two AudioStreamPlayer3D. One for acceleration and one for deceleration. I assign the wav file for acceleration (on.wav) to one AudioStreamPlayer3D and the off.wav file to the other. In the code, I set pitch and volume for both AudioStreamPlayer3D - depending on whether I am accelerating or decelerating (and of course how fast the car is currently traveling).