mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
Now entities will be snapped to the terrarin after they spawn.
This commit is contained in:
parent
bb955630fc
commit
315df2a10a
@ -91,6 +91,7 @@ var model_rotation_node : Spatial
|
||||
var character_skeleton : CharacterSkeleton3D
|
||||
|
||||
var visibility_update_timer : float = 0
|
||||
var placed : bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
camera = get_node_or_null("CameraPivot/Camera") as Camera
|
||||
@ -177,6 +178,22 @@ func _physics_process(delta : float) -> void:
|
||||
if dead:
|
||||
return
|
||||
|
||||
if not placed:
|
||||
if world != null:
|
||||
if not world.is_position_walkable(transform.origin):
|
||||
return
|
||||
|
||||
var space : PhysicsDirectSpaceState = get_world().direct_space_state
|
||||
|
||||
var res : Dictionary = space.intersect_ray(transform.origin, transform.origin + Vector3(0, -100, 0), [ self ])
|
||||
|
||||
if not res.empty():
|
||||
var pos : Vector3 = res["position"]
|
||||
transform.origin = pos + Vector3(0, 0.2, 0)
|
||||
|
||||
placed = true
|
||||
return
|
||||
|
||||
if entity.c_is_controlled:
|
||||
process_input(delta)
|
||||
process_movement_player(delta)
|
||||
|
Loading…
Reference in New Issue
Block a user