DEV Community

Hizrawan Dwi Oka
Hizrawan Dwi Oka

Posted on • Updated on

Game Development Diary #3 : Still GameDev.tv Course

23/05/2024 - Thursday

Day Three

Today's Progress:

-> Make the level out of CSGShapes to give a basic environment to work with.

Image description

You can choose color for the material using this tools

Image description

-> Add the player to the blockout level and finish setting up the camera and environment.

Image description

-> Convert the player into a RigidBody3D and control it with forces.

   A RigidBody3D is a 3D physics body that is moved by a physics simulation.
Enter fullscreen mode Exit fullscreen mode
extends Node3D


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
    if Input.is_action_pressed("ui_accept"):
        #Move the character posistion
        position.y += delta
    if Input.is_action_pressed("ui_left"):
        rotate_z(delta)
    if Input.is_action_pressed("ui_right"):
        rotate_z(-delta)

Enter fullscreen mode Exit fullscreen mode

this is the previous code

extends RigidBody3D


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
    if Input.is_action_pressed("ui_accept"):
        apply_central_force(basis.y * delta * 1000.0)
    if Input.is_action_pressed("ui_right"):
        apply_torque(Vector3(0.0,0.0,100.0 * delta))
    if Input.is_action_pressed("ui_left"):
        apply_torque(Vector3(0.0,0.0,-100.0 * delta))


Enter fullscreen mode Exit fullscreen mode

this is the new code

this code make the character move according to the user input. But instead of transforming the position manually like the previous code, we use apply central force to move the character against the gravity and apply torque to rotate the character

-> Remap some of input to more intuitive controls.

    In the project setting there are inputmap tab, this menu allows us to set all the input we need for the game 
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Image description

-> Detect RigidBody collisions with signals and identify bodies with Groups.

Signal let the game objects communicate with each other. 
Enter fullscreen mode Exit fullscreen mode

Image description

Resource:

Complete Godot 3D: Code Your Own 3D Games In Godot 4! - GameDevTv Courses.

Next Steps:

-> Learn about tween and implement it in the tutorial's game
-> Adding audio
-> Controlling Audio with script
-> Learn about particle and implement it

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.