Godot Version
4.2.2
Question
I’m still very new to programming and I’m trying to recreate fnaf in godot, I’d like to know how I can make the FNaF office scrolling but in 3D
4.2.2
I’m still very new to programming and I’m trying to recreate fnaf in godot, I’d like to know how I can make the FNaF office scrolling but in 3D
I’m not sure what office scrolling is.
If it’s looking around at fixed points in a 3d scene that’s pretty easy.
You have a 3d scene. Then you can place invisible markers in 3d space that the camera node has reference too. Then when the player wants to look left or right. Perform a transform lerp to the target look point.
var markers:Array[Marker3D] = []
var look_index : int = 0
var target_marker: Marker3D = Marker3D.new()
func init_markers(m:Array[Marker3D], starting_marker:int):
markers = m
look_index = starting_marker
target_marker = markers[look_index]
# look at starting marker immediately
self.global_transform = look_at(target_marker.global_transform)
func _unhandled_input(event):
if event.is_action("ui_left"):
look_left()
# Todo look right
func look_left():
if markers.is_empty():
push_error("error: no markers to look at!")
return
if look_index > 0:
look_index -= 1
target_marker = markers[look_index]
func _physics_proceas(delta):
self.global_transform = self.global_transform.slerp(look_at(target_marker.global_transform), 0.01)
Note this code may have bugs.