petit fix
This commit is contained in:
parent
d83058a3f7
commit
fca412affc
2 changed files with 51 additions and 49 deletions
|
@ -62,49 +62,51 @@ func process_input(delta):
|
||||||
|
|
||||||
|
|
||||||
func process_movement(delta):
|
func process_movement(delta):
|
||||||
dir.y = 0
|
|
||||||
dir = dir.normalized()
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||||
|
dir.y = 0
|
||||||
# vel.y += delta*GRAVITY
|
dir = dir.normalized()
|
||||||
|
|
||||||
var hvel = vel
|
# vel.y += delta*GRAVITY
|
||||||
hvel.y = 0
|
|
||||||
|
var hvel = vel
|
||||||
var target = dir
|
hvel.y = 0
|
||||||
target *= MAX_SPEED
|
|
||||||
|
var target = dir
|
||||||
var accel
|
target *= MAX_SPEED
|
||||||
if dir.dot(hvel) > 0:
|
|
||||||
accel = ACCEL
|
var accel
|
||||||
else:
|
if dir.dot(hvel) > 0:
|
||||||
accel = DEACCEL
|
accel = ACCEL
|
||||||
|
else:
|
||||||
hvel = hvel.linear_interpolate(target, accel*delta)
|
accel = DEACCEL
|
||||||
vel.x = hvel.x
|
|
||||||
vel.z = hvel.z
|
hvel = hvel.linear_interpolate(target, accel*delta)
|
||||||
# vel = move_and_slide(vel,Vector3(0,1,0), 0.05, 4, deg2rad(MAX_SLOPE_ANGLE))
|
vel.x = hvel.x
|
||||||
var collision_info = move_and_collide(vel * delta)
|
vel.z = hvel.z
|
||||||
if collision_info:
|
# vel = move_and_slide(vel,Vector3(0,1,0), 0.05, 4, deg2rad(MAX_SLOPE_ANGLE))
|
||||||
vel = vel.bounce(collision_info.normal)
|
var collision_info = move_and_collide(vel * delta)
|
||||||
var obj = collision_info.collider
|
if collision_info:
|
||||||
if obj.is_class( "RigidBody" ):
|
vel = vel.bounce(collision_info.normal)
|
||||||
obj.sleeping = false
|
var obj = collision_info.collider
|
||||||
obj.apply_impulse( collision_info.position, -collision_info.normal*delta )
|
if obj.is_class( "RigidBody" ):
|
||||||
if not obj.get_node( "MeshInstance" ).get_surface_material(0).get("albedo_color") == null:
|
obj.sleeping = false
|
||||||
obj.get_node( "MeshInstance" ).get_surface_material(0).albedo_color = Color( 1, 0, 1, 1 )
|
obj.apply_impulse( collision_info.position, -collision_info.normal*delta )
|
||||||
get_node( "../../GUI/HUD/Jauges/douleur/ProgressBar" ).value += 0.25
|
if not obj.get_node( "MeshInstance" ).get_surface_material(0).get("albedo_color") == null:
|
||||||
if get_node( "../../GUI/HUD/Jauges/douleur/ProgressBar" ).value >= 100:
|
obj.get_node( "MeshInstance" ).get_surface_material(0).albedo_color = Color( 1, 0, 1, 1 )
|
||||||
get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value += 0.25
|
get_node( "../../GUI/HUD/Jauges/douleur/ProgressBar" ).value += 0.25
|
||||||
if get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value >= 100:
|
if get_node( "../../GUI/HUD/Jauges/douleur/ProgressBar" ).value >= 100:
|
||||||
get_node( "../../GUI/HUD/Jauges/oubli/ProgressBar" ).value += 0.25
|
get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value += 0.25
|
||||||
# obj.get_node( "MeshInstance" ).get_surface_material(0).albedo_color = Color( collision_info.normal )
|
if get_node( "../../GUI/HUD/Jauges/trauma/ProgressBar" ).value >= 100:
|
||||||
# if obj.has_method( "hit" ):
|
get_node( "../../GUI/HUD/Jauges/oubli/ProgressBar" ).value += 0.25
|
||||||
# obj.hit( collision_info.position, collision_info.collider_velocity )
|
# obj.get_node( "MeshInstance" ).get_surface_material(0).albedo_color = Color( collision_info.normal )
|
||||||
|
# if obj.has_method( "hit" ):
|
||||||
|
# obj.hit( collision_info.position, collision_info.collider_velocity )
|
||||||
# print(str(collision_info.collider.get_class()))
|
|
||||||
|
|
||||||
|
# print(str(collision_info.collider.get_class()))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
[ext_resource path="res://scenes/Game/Character/Character.gd" type="Script" id=1]
|
[ext_resource path="res://scenes/Game/Character/Character.gd" type="Script" id=1]
|
||||||
|
|
||||||
[sub_resource type="SphereShape" id=2]
|
[sub_resource type="SphereShape" id=1]
|
||||||
|
|
||||||
radius = 0.897042
|
radius = 0.897042
|
||||||
|
|
||||||
[sub_resource type="SphereMesh" id=1]
|
[sub_resource type="SphereMesh" id=2]
|
||||||
|
|
||||||
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
|
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
|
||||||
radius = 1.0
|
radius = 1.0
|
||||||
|
@ -15,7 +15,7 @@ radial_segments = 64
|
||||||
rings = 32
|
rings = 32
|
||||||
is_hemisphere = false
|
is_hemisphere = false
|
||||||
|
|
||||||
[node name="Character" type="KinematicBody"]
|
[node name="Character" type="KinematicBody" index="0"]
|
||||||
|
|
||||||
transform = Transform( 1, 0, 0, 0, 0.589355, 0, 0, 0, 1, -0.0409546, 1.06519, 6.02408 )
|
transform = Transform( 1, 0, 0, 0, 0.589355, 0, 0, 0, 1, -0.0409546, 1.06519, 6.02408 )
|
||||||
input_ray_pickable = true
|
input_ray_pickable = true
|
||||||
|
@ -55,8 +55,8 @@ _sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="CollisionShape" type="CollisionShape" parent="." index="1"]
|
[node name="CollisionShape" type="CollisionShape" parent="." index="1"]
|
||||||
|
|
||||||
transform = Transform( 0.364654, 0, 0, 0, -2.47558e-08, -0.566346, 0, 0.313738, -1.37139e-08, 0.0505983, 4.32164, 0 )
|
transform = Transform( 0.364654, 0, 0, 0, -2.47558e-008, -0.566346, 0, 0.313738, -1.37139e-008, 0.0505983, 4.32164, 0 )
|
||||||
shape = SubResource( 2 )
|
shape = SubResource( 1 )
|
||||||
disabled = false
|
disabled = false
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ lod_min_distance = 0.0
|
||||||
lod_min_hysteresis = 0.0
|
lod_min_hysteresis = 0.0
|
||||||
lod_max_distance = 0.0
|
lod_max_distance = 0.0
|
||||||
lod_max_hysteresis = 0.0
|
lod_max_hysteresis = 0.0
|
||||||
mesh = SubResource( 1 )
|
mesh = SubResource( 2 )
|
||||||
skeleton = NodePath("..")
|
skeleton = NodePath("..")
|
||||||
material/0 = null
|
material/0 = null
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue