initial uncanny work
This commit is contained in:
parent
ab2d42ccd9
commit
8165cda61c
11 changed files with 132 additions and 12 deletions
|
@ -52,7 +52,7 @@ resource_name = "Not Moving"
|
|||
script = ExtResource("8_d5slg")
|
||||
expression = "velocity.is_zero_approx()"
|
||||
|
||||
[node name="CannyCat" type="CharacterBody3D" node_paths=PackedStringArray("state_chart", "graphics", "power_indicator", "camera_arm", "collision_shape")]
|
||||
[node name="CannyCat" type="CharacterBody3D" node_paths=PackedStringArray("state_chart", "graphics", "power_indicator", "camera_arm", "collision_shape") groups=["chaser_target"]]
|
||||
process_priority = -100
|
||||
process_physics_priority = -100
|
||||
collision_layer = 16
|
||||
|
@ -87,7 +87,7 @@ shape = SubResource("SphereShape3D_4o01j")
|
|||
[node name="Graphics" type="Node3D" parent="."]
|
||||
|
||||
[node name="CannySprite" type="Sprite3D" parent="Graphics"]
|
||||
pixel_size = 0.0156
|
||||
pixel_size = 0.0313
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = ExtResource("1_cp4br")
|
||||
|
@ -136,7 +136,7 @@ mesh = SubResource("CylinderMesh_b16dl")
|
|||
[node name="CameraArm" type="SpringArm3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 0, 0)
|
||||
collision_mask = 8
|
||||
spring_length = 8.0
|
||||
spring_length = 7.0
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="CameraArm"]
|
||||
current = true
|
||||
|
|
26
objects/uncanny_cat.gd
Normal file
26
objects/uncanny_cat.gd
Normal file
|
@ -0,0 +1,26 @@
|
|||
extends CharacterBody3D
|
||||
|
||||
|
||||
@export var acceleration: float
|
||||
@export var speed: float
|
||||
@export var vertical_speed: float
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var target: Node3D = null
|
||||
for node in get_tree().get_nodes_in_group(&"chaser_target"):
|
||||
if node is Node3D:
|
||||
if not target or (
|
||||
global_position.distance_squared_to(node.global_position) <
|
||||
global_position.distance_squared_to(target.global_position)
|
||||
):
|
||||
target = node
|
||||
|
||||
if target:
|
||||
velocity += global_position.direction_to(target.global_position) * acceleration * delta
|
||||
velocity = velocity.limit_length(speed)
|
||||
velocity.y = (target.global_position.y - global_position.y) * vertical_speed
|
||||
|
||||
var col = move_and_collide(velocity * delta)
|
||||
if col:
|
||||
velocity = velocity.bounce(col.get_normal())
|
1
objects/uncanny_cat.gd.uid
Normal file
1
objects/uncanny_cat.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://1mhmcaluavhg
|
47
objects/uncanny_cat.tscn
Normal file
47
objects/uncanny_cat.tscn
Normal file
|
@ -0,0 +1,47 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://bndtsprfwrkau"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://1mhmcaluavhg" path="res://objects/uncanny_cat.gd" id="1_bsm3e"]
|
||||
[ext_resource type="Texture2D" uid="uid://c2a63sfnh6il" path="res://assets/textures/chaser/uncanny.png" id="2_eotxf"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_eotxf"]
|
||||
radius = 0.45
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eotxf"]
|
||||
transparency = 3
|
||||
alpha_hash_scale = 1.0
|
||||
alpha_antialiasing_mode = 0
|
||||
no_depth_test = true
|
||||
shading_mode = 0
|
||||
albedo_color = Color(1, 0, 0, 0.501961)
|
||||
albedo_texture = ExtResource("2_eotxf")
|
||||
texture_filter = 0
|
||||
billboard_mode = 1
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ixuei"]
|
||||
|
||||
[node name="UncannyCat" type="CharacterBody3D"]
|
||||
collision_layer = 32
|
||||
collision_mask = 32
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_bsm3e")
|
||||
acceleration = 0.6
|
||||
speed = 1.5
|
||||
vertical_speed = 0.5
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_eotxf")
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
material_overlay = SubResource("StandardMaterial3D_eotxf")
|
||||
pixel_size = 0.0313
|
||||
billboard = 1
|
||||
texture_filter = 0
|
||||
texture = ExtResource("2_eotxf")
|
||||
|
||||
[node name="PlayerDetector" type="Area3D" parent="."]
|
||||
collision_layer = 0
|
||||
collision_mask = 16
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerDetector"]
|
||||
shape = SubResource("SphereShape3D_ixuei")
|
Loading…
Add table
Add a link
Reference in a new issue