Godot oyunda kamera cevirmesi nasil yapilir?

BRENMEST

Hectopat
Katılım
5 Temmuz 2022
Mesajlar
159
Arkadaşlar başlıkta dediğim gibi durum karakterin içinde 2 tane script var, birisi mouse hareketlerini okuyor yani bu:

Extends characterbody3D.

Func _input(Event: Inputevent) -> Void:
İf Event is ınputeventmousemotion:
Var mouse_motion = Event. Relative # bu, fare hareketini alır.
Print("fare hareketi: ", mouse_motion)

Diğeri ise hazır Godot'un yürüme scripti:

Extends characterbody3D.

Const Speed = 5.0
Const jump_velocıty = 8.5

# Get the gravity from the project settings to be synced with rigidbody nodes.
Var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")

Var mouse_sensevity = 0.2
Func _physics_process(Delta):
# Add the gravity.
İf not is_on_floor():
Velocity. Y -= gravity * Delta.

# Handle jump.
İf ınput. İs_action_just_pressed("ui_accept") and is_on_floor():
Velocity. Y = jump_velocıty.

# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with Custom gameplay actions.
Var input_dir = ınput. Get_vector("ui_left", "ui_right", "ui_up", "ui_down")
Var direction = (transform. Basis * Vector3(input_dir. X, 0, input_dir.y)).normalized()
İf direction:
Velocity. X = direction. X * Speed.
Velocity. Z = direction. Z * Speed.
Else:
Velocity. X = move_toward(velocity. X, 0, Speed)
Velocity. Z = move_toward(velocity. Z, 0, Speed)

move_and_slide()

Scriptler bunlar peki arkadaşlar, ne yapmalıyım kamerayı hareket ettirmek için?
 

Bu konuyu görüntüleyen kullanıcılar

Technopat Haberler

Geri
Yukarı