update rotation multiplayer

This commit is contained in:
AleaJactaEst 2023-11-25 00:00:05 +01:00
parent fbeca50eba
commit 3c510cbcc5
13 changed files with 245 additions and 196 deletions

View file

@ -9,18 +9,18 @@ func _physics_process(_delta):
#Set Animation State
match movement_script.movement_state:
Global.MOVEMENT_STATE.none:
Global.MOVEMENT_STATE.NONE:
pass
Global.MOVEMENT_STATE.grounded: # Sol
Global.MOVEMENT_STATE.GROUNDED: # Sol
set("parameters/InAir/blend_amount" , 0.0)
#set("parameters/TimeSeek/seek_request", 0.0)
#set("parameters/Transition/transition_request","Idle")
Global.MOVEMENT_STATE.in_air: # Air
Global.MOVEMENT_STATE.IN_AIR: # Air
set("parameters/InAir/blend_amount" , 1.0)
#set("parameters/InAir/transition_request","Failling")
Global.MOVEMENT_STATE.mantling: # couverture
Global.MOVEMENT_STATE.MANTLING: # couverture
pass
Global.MOVEMENT_STATE.ragdoll:
Global.MOVEMENT_STATE.RAGDOLL:
pass
#set("parameters/Transition/transition_request","Idle")
#set("parameters/InAir/blend_amount" , 0.5)
@ -32,17 +32,17 @@ func _physics_process__old(_delta):
#Set Animation State
match movement_script.movement_state:
Global.MOVEMENT_STATE.none:
Global.MOVEMENT_STATE.NONE:
pass
Global.MOVEMENT_STATE.grounded: # Sol
Global.MOVEMENT_STATE.GROUNDED: # Sol
set("parameters/InAir/blend_amount" , 0.0)
#set("parameters/Transition/transition_request","Idle")
Global.MOVEMENT_STATE.in_air: # Air
Global.MOVEMENT_STATE.IN_AIR: # Air
set("parameters/InAir/blend_amount" , 1.0)
#set("parameters/InAir/transition_request","Failling")
Global.MOVEMENT_STATE.mantling: # couverture
Global.MOVEMENT_STATE.MANTLING: # couverture
pass
Global.MOVEMENT_STATE.ragdoll:
Global.MOVEMENT_STATE.RAGDOLL:
pass
#standing
@ -50,28 +50,29 @@ func _physics_process__old(_delta):
set("parameters/Transition/transition_request","Idle")
#set("parameters/VelocityDirection/Standing/transition_request","Idle")
#set("parameters/VelocityDirection/crouching/transition_request","Idle")
if movement_script.gait == Global.GAIT.walking and movement_script.input_is_moving:
if movement_script.gait == Global.GAIT.WALKING and movement_script.input_is_moving:
set("parameters/Transition/transition_request","WalkForward")
#set("parameters/VelocityDirection/Standing/transition_request","Walk")
#set("parameters/VelocityDirection/crouching/transition_request","Walk")
if movement_script.gait == Global.GAIT.running and movement_script.input_is_moving:
if movement_script.gait == Global.GAIT.RUNNING and movement_script.input_is_moving:
set("parameters/Transition/transition_request","JogForward")
#set("parameters/VelocityDirection/Standing/transition_request","Jog")
if movement_script.gait == Global.GAIT.sprinting and movement_script.input_is_moving:
if movement_script.gait == Global.GAIT.SPRINTING and movement_script.input_is_moving:
set("parameters/Transition/transition_request","Run")
#set("parameters/Execution/transition_request","Run")
#Couch/stand switch
match movement_script.stance:
Global.STANCE.standing:
Global.STANCE.STANDING:
set("parameters/Transition/transition_request","stand")
#set("parameters/VelocityDirection/crouch/transition_request" , "stand")
Global.STANCE.crouching:
Global.STANCE.CROUCHING:
set("parameters/Transition/transition_request","crouch")
#set("parameters/VelocityDirection/crouch/transition_request" , "crouch")
if movement_script.rotation_mode == Global.ROTATION_MODE.looking_direction or movement_script.rotation_mode == Global.ROTATION_MODE.aiming:
if movement_script.rotation_mode == Global.ROTATION_MODE.LOOKING_DIRECTION or \
movement_script.rotation_mode == Global.ROTATION_MODE.AIMING:
if movement_script.animation_is_moving_backward_relative_to_camera == false:
set("parameters/Transition/transition_request","WalkForward")
#set("parameters/VelocityDirection/WalkFB/transition_request","Forward")

View file

@ -13,7 +13,7 @@ class_name CameraComponent
#####################################
var CameraHOffset := 0.0
@export var view_angle : Global.VIEW_ANGLE = Global.VIEW_ANGLE.right_shoulder:
@export var view_angle : Global.VIEW_ANGLE = Global.VIEW_ANGLE.RIGHT_SHOULDER:
get: return view_angle
set(Newview_angle):
# if view_mode == Global.VIEW_MODE.first_person:
@ -21,18 +21,18 @@ var CameraHOffset := 0.0
view_angle = Newview_angle
if Camera:
match Newview_angle:
Global.VIEW_ANGLE.right_shoulder:
Global.VIEW_ANGLE.RIGHT_SHOULDER:
CameraHOffset = 0.45
update_camera_offset()
Global.VIEW_ANGLE.left_shoulder:
Global.VIEW_ANGLE.LEFT_SHOULDER:
CameraHOffset = -0.45
update_camera_offset()
Global.VIEW_ANGLE.head:
Global.VIEW_ANGLE.HEAD:
CameraHOffset = 0.0
update_camera_offset()
@export var view_mode : Global.VIEW_MODE = Global.VIEW_MODE.third_person :
@export var view_mode : Global.VIEW_MODE = Global.VIEW_MODE.THIRD_PERSON :
get: return view_mode
set(Newview_mode):
view_mode = Newview_mode
@ -40,12 +40,12 @@ var CameraHOffset := 0.0
VObject.rotation.x = 0.0
if SpringArm:
match view_mode:
Global.VIEW_MODE.first_person:
view_angle = Global.VIEW_ANGLE.head
PlayerRef.rotation_mode = Global.ROTATION_MODE.looking_direction
Global.VIEW_MODE.FIRST_PERSON:
view_angle = Global.VIEW_ANGLE.HEAD
PlayerRef.rotation_mode = Global.ROTATION_MODE.LOOKING_DIRECTION
SpringArm.spring_length = -0.4
VObject = Camera
Global.VIEW_MODE.third_person:
Global.VIEW_MODE.THIRD_PERSON:
SpringArm.spring_length = 1.75
VObject = SpringArm
@ -71,20 +71,20 @@ func _physics_process(delta):
if camera_settings.camera_change_fov_on_speed and PlayerRef.actual_velocity.length() > camera_settings.camera_fov_change_starting_speed:
smooth_fov(current_fov + clampf((PlayerRef.actual_velocity.length()-camera_settings.camera_fov_change_starting_speed)*(camera_settings.camera_max_fov_change/10.0),0,camera_settings.camera_max_fov_change))
SpringArm.position = SpringArm.position.lerp((get_parent().global_position + spring_arm_position_relative_to_player) if view_mode == Global.VIEW_MODE.third_person else first_person_camera_bone.global_position,(1/camera_settings.camera_inertia) if view_mode == Global.VIEW_MODE.third_person else 1.0)
SpringArm.position = SpringArm.position.lerp((get_parent().global_position + spring_arm_position_relative_to_player) if view_mode == Global.VIEW_MODE.THIRD_PERSON else first_person_camera_bone.global_position,(1/camera_settings.camera_inertia) if view_mode == Global.VIEW_MODE.THIRD_PERSON else 1.0)
camera_v = clamp(camera_v,deg_to_rad(camera_vertical_min),deg_to_rad(camera_vertical_max))
HObject.rotation.y = lerp(HObject.rotation.y,camera_h,delta * acceleration_h)
VObject.rotation.x = lerp(VObject.rotation.x,camera_v,delta * acceleration_v)
match PlayerRef.rotation_mode:
Global.ROTATION_MODE.aiming:
if PlayerRef.gait == Global.GAIT.sprinting: # character can't sprint while aiming
PlayerRef.gait = Global.GAIT.running
Global.ROTATION_MODE.AIMING:
if PlayerRef.gait == Global.GAIT.SPRINTING: # character can't sprint while aiming
PlayerRef.gait = Global.GAIT.RUNNING
smooth_fov(60.0)
Global.ROTATION_MODE.velocity_direction:
Global.ROTATION_MODE.VELOCITY_DIRECTION:
smooth_fov(90.0)
Global.ROTATION_MODE.looking_direction:
Global.ROTATION_MODE.LOOKING_DIRECTION:
smooth_fov(90.0)

View file

@ -155,22 +155,22 @@ var animation_is_moving_backward_relative_to_camera : bool
var animation_velocity : Vector3
#status
@export var movement_state = Global.MOVEMENT_STATE.grounded
var movement_action = Global.MOVEMENT_ACTION.none
@export var movement_state = Global.MOVEMENT_STATE.GROUNDED
var movement_action = Global.MOVEMENT_ACTION.NONE
@export_category("States")
@export var rotation_mode : Global.ROTATION_MODE = Global.ROTATION_MODE.velocity_direction :
@export var rotation_mode : Global.ROTATION_MODE = Global.ROTATION_MODE.VELOCITY_DIRECTION :
get: return rotation_mode
set(Newrotation_mode):
rotation_mode = Newrotation_mode
update_character_movement()
@export var gait : Global.GAIT = Global.GAIT.walking : # Demarche (attente, marche, ...)
@export var gait : Global.GAIT = Global.GAIT.WALKING : # Demarche (attente, marche, ...)
get: return gait
set(Newgait):
gait = Newgait
update_character_movement()
@export var stance : Global.STANCE = Global.STANCE.standing : # Position (debout, accroupi, ..)
@export var stance : Global.STANCE = Global.STANCE.STANDING : # Position (debout, accroupi, ..)
set(Newstance):
stance = Newstance
update_character_movement()
@ -247,33 +247,33 @@ func update_animations():
func update_character_movement():
match rotation_mode:
Global.ROTATION_MODE.velocity_direction:
Global.ROTATION_MODE.VELOCITY_DIRECTION:
# if skeleton_ref:
# skeleton_ref.modification_stack.enabled = false
tilt = false
match stance:
Global.STANCE.standing:
Global.STANCE.STANDING:
current_movement_data = velocity_direction_standing_data
Global.STANCE.crouching:
Global.STANCE.CROUCHING:
current_movement_data = velocity_direction_crouch_data
Global.ROTATION_MODE.looking_direction:
Global.ROTATION_MODE.LOOKING_DIRECTION:
# if skeleton_ref:
# skeleton_ref.modification_stack.enabled = false #Change to true when Godot fixes the bug.
tilt = true
match stance:
Global.STANCE.standing:
Global.STANCE.STANDING:
current_movement_data = looking_direction_standing_data
Global.STANCE.crouching:
Global.STANCE.CROUCHING:
current_movement_data = looking_direction_crouch_data
Global.ROTATION_MODE.aiming:
Global.ROTATION_MODE.AIMING:
match stance:
Global.STANCE.standing:
Global.STANCE.STANDING:
current_movement_data = aim_standing_data
Global.STANCE.crouching:
Global.STANCE.CROUCHING:
current_movement_data = aim_crouch_data
#####################################
@ -311,13 +311,18 @@ func _ready():
update_animations()
update_character_movement()
var pose_warping_instance = PoseWarping.new()
func _process(delta):
calc_animation_data()
var orientation_warping_condition = rotation_mode != Global.ROTATION_MODE.velocity_direction and movement_state == Global.MOVEMENT_STATE.grounded and movement_action == Global.MOVEMENT_ACTION.none and gait != Global.GAIT.sprinting and input_is_moving
var orientation_warping_condition = rotation_mode != Global.ROTATION_MODE.VELOCITY_DIRECTION and \
movement_state == Global.MOVEMENT_STATE.GROUNDED and \
movement_action == Global.MOVEMENT_ACTION.NONE and \
gait != Global.GAIT.SPRINTING and \
input_is_moving
pose_warping_instance.orientation_warping( orientation_warping_condition,camera_root.HObject,animation_velocity,skeleton_ref,"Hips",["Spine","Spine1","Spine2"],0.0,delta)
func _physics_process(delta):
#Debug()
#
@ -327,43 +332,43 @@ func _physics_process(delta):
#animation_stride_warping()
match movement_state:
Global.MOVEMENT_STATE.none:
Global.MOVEMENT_STATE.NONE:
pass
Global.MOVEMENT_STATE.grounded:
Global.MOVEMENT_STATE.GROUNDED:
#------------------ Rotate Character Mesh ------------------#
match movement_action:
Global.MOVEMENT_ACTION.none:
Global.MOVEMENT_ACTION.NONE:
match rotation_mode:
Global.ROTATION_MODE.velocity_direction:
Global.ROTATION_MODE.VELOCITY_DIRECTION:
if (is_moving and input_is_moving) or (actual_velocity * Vector3(1.0,0.0,1.0)).length() > 0.5:
smooth_character_rotation(actual_velocity,calc_grounded_rotation_rate(),delta)
Global.ROTATION_MODE.looking_direction:
Global.ROTATION_MODE.LOOKING_DIRECTION:
if (is_moving and input_is_moving) or (actual_velocity * Vector3(1.0,0.0,1.0)).length() > 0.5:
smooth_character_rotation(-camera_root.HObject.transform.basis.z if gait != Global.GAIT.sprinting else actual_velocity,calc_grounded_rotation_rate(),delta)
smooth_character_rotation(-camera_root.HObject.transform.basis.z if gait != Global.GAIT.SPRINTING else actual_velocity,calc_grounded_rotation_rate(),delta)
rotate_in_place_check()
Global.ROTATION_MODE.aiming:
Global.ROTATION_MODE.AIMING:
if (is_moving and input_is_moving) or (actual_velocity * Vector3(1.0,0.0,1.0)).length() > 0.5:
smooth_character_rotation(-camera_root.HObject.transform.basis.z,calc_grounded_rotation_rate(),delta)
rotate_in_place_check()
Global.MOVEMENT_ACTION.rolling:
Global.MOVEMENT_ACTION.ROLLING:
if input_is_moving == true:
smooth_character_rotation(input_acceleration ,2.0,delta)
Global.MOVEMENT_STATE.in_air:
Global.MOVEMENT_STATE.IN_AIR:
#------------------ Rotate Character Mesh In Air ------------------#
match rotation_mode:
Global.ROTATION_MODE.velocity_direction:
Global.ROTATION_MODE.VELOCITY_DIRECTION:
smooth_character_rotation(actual_velocity if (actual_velocity * Vector3(1.0,0.0,1.0)).length() > 1.0 else -camera_root.HObject.transform.basis.z,5.0,delta)
Global.ROTATION_MODE.looking_direction:
Global.ROTATION_MODE.LOOKING_DIRECTION:
smooth_character_rotation(actual_velocity if (actual_velocity * Vector3(1.0,0.0,1.0)).length() > 1.0 else -camera_root.HObject.transform.basis.z,5.0,delta)
Global.ROTATION_MODE.aiming:
Global.ROTATION_MODE.AIMING:
smooth_character_rotation(-camera_root.HObject.transform.basis.z ,15.0,delta)
#------------------ Mantle Check ------------------#
if input_is_moving == true:
mantle_check()
Global.MOVEMENT_STATE.mantling:
Global.MOVEMENT_STATE.MANTLING:
pass
Global.MOVEMENT_STATE.ragdoll:
Global.MOVEMENT_STATE.RAGDOLL:
pass
#------------------ Crouch ------------------#
@ -374,10 +379,10 @@ func _physics_process(delta):
character_node.velocity.y = lerp(character_node.velocity.y,vertical_velocity.y - character_node.get_floor_normal().y,delta * gravity)
character_node.move_and_slide()
if ground_check.is_colliding() and is_flying == false:
movement_state = Global.MOVEMENT_STATE.grounded
movement_state = Global.MOVEMENT_STATE.GROUNDED
else:
await get_tree().create_timer(0.1).timeout #wait a moment to see if the character lands fast (this means that the character didn't fall, but stepped down a bit.)
movement_state = Global.MOVEMENT_STATE.in_air
movement_state = Global.MOVEMENT_STATE.IN_AIR
if character_node is CharacterBody3D:
vertical_velocity += Vector3.DOWN * gravity * delta
if character_node is CharacterBody3D and character_node.is_on_ceiling():
@ -401,10 +406,10 @@ func crouch_update(delta):
ground_check.position.y = -(collision_shape_ref.shape.height/2)+collision_shape_ref.position.y + 0.2#Just a small margin
if stance == Global.STANCE.crouching:
if stance == Global.STANCE.CROUCHING:
collision_shape_ref.shape.height -= crouch_switch_speed * delta /2
mesh_ref.transform.origin.y += crouch_switch_speed * delta /1.5
elif stance == Global.STANCE.standing and not head_bonked:
elif stance == Global.STANCE.STANDING and not head_bonked:
collision_shape_ref.shape.height += crouch_switch_speed * delta /2
mesh_ref.transform.origin.y -= crouch_switch_speed * delta /1.5
elif head_bonked:
@ -431,7 +436,7 @@ func stair_move():
var stair_top_collision = direct_state.intersect_ray(climb_ray_info)
if stair_top_collision:
if stair_top_collision.position.y - character_node.global_position.y > 0 and stair_top_collision.position.y - character_node.global_position.y < 0.15:
movement_state = Global.MOVEMENT_STATE.grounded
movement_state = Global.MOVEMENT_STATE.GROUNDED
is_moving_on_stair = true
character_node.position.y += stair_top_collision.position.y - character_node.global_position.y
character_node.global_position += Vector3(0, 0, 0.01).rotated(Vector3.UP,movement_direction)
@ -463,7 +468,6 @@ var prev :Transform3D
var current :Transform3D
var anim_speed
func animation_stride_warping(): #this is currently being worked on and tested, so I don't reccomend using it.
add_sibling(test_sphere)
add_sibling(test_sphere1)
@ -508,14 +512,13 @@ func animation_stride_warping(): #this is currently being worked on and tested,
func calc_grounded_rotation_rate():
if input_is_moving == true:
match gait:
Global.GAIT.walking:
Global.GAIT.WALKING:
return lerp(current_movement_data.idle_rotation_rate,current_movement_data.walk_rotation_rate, Global.map_range_clamped((actual_velocity * Vector3(1.0,0.0,1.0)).length(),0.0,current_movement_data.walk_speed,0.0,1.0)) * clamp(aim_rate_h,1.0,3.0)
Global.GAIT.running:
Global.GAIT.RUNNING:
return lerp(current_movement_data.walk_rotation_rate,current_movement_data.run_rotation_rate, Global.map_range_clamped((actual_velocity * Vector3(1.0,0.0,1.0)).length(),current_movement_data.walk_speed,current_movement_data.run_speed,1.0,2.0)) * clamp(aim_rate_h,1.0,3.0)
Global.GAIT.sprinting:
Global.GAIT.SPRINTING:
return lerp(current_movement_data.run_rotation_rate,current_movement_data.sprint_rotation_rate, Global.map_range_clamped((actual_velocity * Vector3(1.0,0.0,1.0)).length(),current_movement_data.run_speed,current_movement_data.sprint_speed,2.0,3.0)) * clamp(aim_rate_h,1.0,2.5)
else:
return current_movement_data.idle_rotation_rate * clamp(aim_rate_h,1.0,3.0)

View file

@ -2,25 +2,25 @@ extends Node
#------------------ Player Enums ------------------#
# Demarche (Attend, Marche, Cours, sprint
enum GAIT {waiting, walking , running , sprinting}
enum GAIT {WAITING, WALKING , RUNNING , SPRINTING}
# Sol, Air, Couverture, poupee de chiffon
enum MOVEMENT_STATE {none , grounded , in_air , mantling, ragdoll}
enum MOVEMENT_STATE {NONE , GROUNDED , IN_AIR , MANTLING, RAGDOLL}
#
enum MOVEMENT_ACTION {none ,low_mantle , high_mantle , rolling , getting_up}
enum MOVEMENT_ACTION {NONE ,LOW_MANTLE , HIGH_MANTLE , ROLLING , GETTING_UP}
# Fusis, Pistolet
enum OVERLAY_STATE {default , rifle , pistol}
enum OVERLAY_STATE {DEFAULT , RIFLE , PISTOL}
#
enum ROTATION_MODE {velocity_direction , looking_direction , aiming}
enum ROTATION_MODE {VELOCITY_DIRECTION , LOOKING_DIRECTION , AIMING}
# Position (debout, accroupi)
enum STANCE {standing , crouching}
enum STANCE {STANDING , CROUCHING}
#
enum VIEW_MODE {third_person , first_person}
enum VIEW_MODE {THIRD_PERSON , FIRST_PERSON}
#
enum VIEW_ANGLE {right_shoulder , left_shoulder , head}
enum VIEW_ANGLE {RIGHT_SHOULDER , LEFT_SHOULDER , HEAD}
# Type de cape/manteau
enum MANTLE_TYPE {high_mantle , low_mantle, falling_catch}
enum MANTLE_TYPE {HIGH_MANTLE , LOW_MANTLE, FALLING_CATCH}
# Direction du mouvement (devant, droite, gauche, arriere)
enum MOVEMENT_DIRECTION {forward , right, left, backward}
enum MOVEMENT_DIRECTION {FORWARD , RIGHT, LEFT, BACKWARD}
func map_range_clamped(value,InputMin,InputMax,OutputMin,OutputMax):

View file

@ -50,9 +50,9 @@ func _physics_process(_delta):
remap(v_rotation,-PI/2,PI/2,-1.0,1.0) if character_component.is_flying == true else 0.0,
Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up"))
direction = direction.rotated(Vector3.UP,h_rotation).normalized()
if character_component.gait == Global.GAIT.sprinting :
if character_component.gait == Global.GAIT.SPRINTING :
character_component.add_movement_input(direction, character_component.current_movement_data.sprint_speed,character_component.current_movement_data.sprint_acceleration)
elif character_component.gait == Global.GAIT.running:
elif character_component.gait == Global.GAIT.RUNNING:
character_component.add_movement_input(direction, character_component.current_movement_data.run_speed,character_component.current_movement_data.run_acceleration)
else:
character_component.add_movement_input(direction, character_component.current_movement_data.walk_speed,character_component.current_movement_data.walk_acceleration)
@ -64,55 +64,55 @@ func _physics_process(_delta):
#------------------ Input Crouch ------------------#
if UsingCrouchToggle == false:
if Input.is_action_pressed("ui_crouch"):
if character_component.stance != Global.STANCE.crouching:
character_component.stance = Global.STANCE.crouching
if character_component.stance != Global.STANCE.CROUCHING:
character_component.stance = Global.STANCE.CROUCHING
else:
if character_component.stance != Global.STANCE.standing:
character_component.stance = Global.STANCE.standing
if character_component.stance != Global.STANCE.STANDING:
character_component.stance = Global.STANCE.STANDING
else:
if Input.is_action_just_pressed("ui_crouch"):
character_component.stance = Global.STANCE.standing if character_component.stance == Global.STANCE.crouching else Global.STANCE.crouching
character_component.stance = Global.STANCE.STANDING if character_component.stance == Global.STANCE.CROUCHING else Global.STANCE.CROUCHING
#------------------ Sprint ------------------#
if UsingSprintToggle:
if Input.is_action_just_pressed("ui_sprint"):
if character_component.gait == Global.GAIT.walking:
character_component.gait = Global.GAIT.running
elif character_component.gait == Global.GAIT.running:
character_component.gait = Global.GAIT.sprinting
elif character_component.gait == Global.GAIT.sprinting:
character_component.gait = Global.GAIT.walking
if character_component.gait == Global.GAIT.WALKING:
character_component.gait = Global.GAIT.RUNNING
elif character_component.gait == Global.GAIT.RUNNING:
character_component.gait = Global.GAIT.SPRINTING
elif character_component.gait == Global.GAIT.SPRINTING:
character_component.gait = Global.GAIT.WALKING
else:
if Input.is_action_just_pressed("ui_sprint"):
if character_component.gait == Global.GAIT.walking:
character_component.gait = Global.GAIT.running
elif character_component.gait == Global.GAIT.running:
character_component.gait = Global.GAIT.sprinting
if character_component.gait == Global.GAIT.WALKING:
character_component.gait = Global.GAIT.RUNNING
elif character_component.gait == Global.GAIT.RUNNING:
character_component.gait = Global.GAIT.SPRINTING
if Input.is_action_just_released("ui_sprint"):
if character_component.gait == Global.GAIT.sprinting or character_component.gait == Global.GAIT.walking:
character_component.gait = Global.GAIT.walking
elif character_component.gait == Global.GAIT.running:
if character_component.gait == Global.GAIT.SPRINTING or character_component.gait == Global.GAIT.WALKING:
character_component.gait = Global.GAIT.WALKING
elif character_component.gait == Global.GAIT.RUNNING:
await get_tree().create_timer(0.4).timeout
if character_component.gait == Global.GAIT.running:
character_component.gait = Global.GAIT.walking
if character_component.gait == Global.GAIT.RUNNING:
character_component.gait = Global.GAIT.WALKING
#------------------ Input Aim ------------------#
if Input.is_action_pressed("ui_aim"):
if character_component.rotation_mode != Global.ROTATION_MODE.aiming:
if character_component.rotation_mode != Global.ROTATION_MODE.AIMING:
previous_rotation_mode = character_component.rotation_mode
character_component.rotation_mode = Global.ROTATION_MODE.aiming
character_component.rotation_mode = Global.ROTATION_MODE.AIMING
else:
if character_component.rotation_mode == Global.ROTATION_MODE.aiming:
if character_component.rotation_mode == Global.ROTATION_MODE.AIMING:
character_component.rotation_mode = previous_rotation_mode
#------------------ Jump ------------------#=
if OnePressJump == true:
if Input.is_action_just_pressed("ui_jump"):
if character_component.stance != Global.STANCE.standing:
character_component.stance = Global.STANCE.standing
if character_component.stance != Global.STANCE.STANDING:
character_component.stance = Global.STANCE.STANDING
else:
character_component.jump()
else:
if Input.is_action_pressed("ui_jump"):
if character_component.stance != Global.STANCE.standing:
character_component.stance = Global.STANCE.standing
if character_component.stance != Global.STANCE.STANDING:
character_component.stance = Global.STANCE.STANDING
else:
character_component.jump()
@ -167,7 +167,7 @@ func _input(event):
character_component.ragdoll = true
if character_component.rotation_mode == Global.ROTATION_MODE.velocity_direction:
if character_component.rotation_mode == Global.ROTATION_MODE.VELOCITY_DIRECTION:
if character_component.camera_root != null:
if character_component.camera_root.view_mode == Global.VIEW_MODE.first_person:
character_component.camera_root.view_mode = Global.VIEW_MODE.third_person
if character_component.camera_root.view_mode == Global.VIEW_MODE.FIRST_PERSON:
character_component.camera_root.view_mode = Global.VIEW_MODE.THIRD_PERSON

View file

@ -14,11 +14,13 @@ func _ready():
func _process(delta):
if gait != Global.GAIT.sprinting and stamina_use:
#if !networking.is_local_authority():
# return
if gait != Global.GAIT.SPRINTING and stamina_use:
stamina_attribute.being_used = false
if gait == Global.GAIT.sprinting and stamina_use:
if gait == Global.GAIT.SPRINTING and stamina_use:
if !stamina_attribute.can_use or stamina_attribute.current_value < stamina_energy_consumption*delta:
gait = Global.GAIT.running
gait = Global.GAIT.RUNNING
return
stamina_attribute.being_used = true
stamina_attribute.current_value -= stamina_energy_consumption*delta
@ -27,25 +29,24 @@ func _physics_process(delta):
super._physics_process(delta)
# Debug()
if !networking.is_local_authority():
if input_is_moving:
if gait == Global.GAIT.sprinting:
add_movement_input(input_direction, current_movement_data.sprint_speed,current_movement_data.sprint_acceleration)
elif gait == Global.GAIT.running:
add_movement_input(input_direction, current_movement_data.run_speed,current_movement_data.run_acceleration)
else:
add_movement_input(input_direction, current_movement_data.walk_speed,current_movement_data.walk_acceleration)
else:
add_movement_input(input_direction,0,deacceleration)
# if input_is_moving:
# if gait == Global.GAIT.sprinting:
# add_movement_input(input_direction, current_movement_data.sprint_speed,current_movement_data.sprint_acceleration)
# elif gait == Global.GAIT.running:
# add_movement_input(input_direction, current_movement_data.run_speed,current_movement_data.run_acceleration)
# else:
# add_movement_input(input_direction, current_movement_data.walk_speed,current_movement_data.walk_acceleration)
# else:
# add_movement_input(input_direction,0,deacceleration)
return
#------------------ Look At ------------------#
match rotation_mode:
Global.ROTATION_MODE.velocity_direction:
Global.ROTATION_MODE.VELOCITY_DIRECTION:
if input_is_moving:
ik_look_at(actual_velocity + Vector3(0.0,1.0,0.0))
Global.ROTATION_MODE.looking_direction:
Global.ROTATION_MODE.LOOKING_DIRECTION:
ik_look_at(camera_root.SpringArm.transform.basis.z * 2.0 + Vector3(0.0,1.5,0.0))
Global.ROTATION_MODE.aiming:
Global.ROTATION_MODE.AIMING:
ik_look_at(camera_root.SpringArm.transform.basis.z * 2.0 + Vector3(0.0,1.5,0.0))
#func Debug():
# $Status/Label.text = "InputSpeed : %s" % input_velocity.length()

View file

@ -6,7 +6,7 @@ class_name PlayerNetworkingComponent
var sync_camera_h_transform : Transform3D
var sync_camera_v_transform : Transform3D
var sync_view_mode : Global.VIEW_MODE = Global.VIEW_MODE.third_person
var sync_view_mode : Global.VIEW_MODE = Global.VIEW_MODE.THIRD_PERSON
var sync_CameraHOffset : float
var sync_position : Vector3:
set(value):
@ -15,11 +15,11 @@ var sync_position : Vector3:
var sync_mesh_rotation : Vector3
var sync_direction : Vector3
var sync_input_is_moving : bool
var sync_gait : Global.GAIT = Global.GAIT.walking
var sync_rotation_mode : Global.ROTATION_MODE = Global.ROTATION_MODE.velocity_direction
var sync_stance : Global.STANCE = Global.STANCE.standing
var sync_movement_state : Global.MOVEMENT_STATE = Global.MOVEMENT_STATE.grounded
var sync_movement_action : Global.MOVEMENT_ACTION = Global.MOVEMENT_ACTION.none
var sync_gait : Global.GAIT = Global.GAIT.WALKING
var sync_rotation_mode : Global.ROTATION_MODE = Global.ROTATION_MODE.VELOCITY_DIRECTION
var sync_stance : Global.STANCE = Global.STANCE.STANDING
var sync_movement_state : Global.MOVEMENT_STATE = Global.MOVEMENT_STATE.GROUNDED
var sync_movement_action : Global.MOVEMENT_ACTION = Global.MOVEMENT_ACTION.NONE
var sync_velocity : Vector3
var processed_position : bool
@ -53,6 +53,7 @@ func is_local_authority() -> bool:
#sync player on clients
func _physics_process(_delta):
return
if !is_local_authority():
if not processed_position:
PlayerRef.character_node.position = sync_position

View file

@ -11,6 +11,8 @@ var camrot_v:float = 0.0
@export var h_sensitivity:float = 0.5
@export var v_sensitivity:float = 0.5
var save_rot:Vector3
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
@ -24,9 +26,25 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func set_otherplayer(value:bool):
otherplayer = value
#
#func _set(property:String, value) -> bool:
# if property == "position":
# print("changed position ",value)
# return false
func _ready():
$SpringArm3D/Camera3D.set_current(false)
set_process(false)
# $CameraComponent.set_process(false)
# $PlayerController.set_process(false)
# $PlayerNetworkingComponent.set_process(false)
# $CharacterMovementComponent.set_process(false)
# $TargetingComponent.set_process(false)
# $CombatSystem.set_process(false)
# $AttributesManager.set_process(false)
# $AttributesManager/HealthAttribute.set_process(false)
# $AttributesManager/StaminaAttribute.set_process(false)
#$PlayerGameplayComponent.update_animations()
@ -48,7 +66,10 @@ func set_my_position(pos:Vector3):
func set_my_rotation(rot:Vector3):
#$Armature.set_global_rotation(rot)
save_rot = rot
print("Update ->" + str(rot))
$Armature.set_global_rotation(rot)
#$CharacterMovementComponent.input_direction = rot
pass
@ -63,7 +84,8 @@ func set_id(value:int) -> void:
func set_activate() -> void:
#$AnimationTree.set_active(true)
#$AnimationTree.set("parameters/Transition/transition_request","Idle")
pass
set_process(true)
#func set_animation_tree_blend_positions(input_vector: Vector2) -> void:
# #print("Blend Position: ", input_vector)
@ -71,16 +93,24 @@ func set_activate() -> void:
# $AnimationTree.set("parameters/Walk/blend_position", input_vector)
func get_comment() -> String:
return str(save_rot) + \
" -> " + str($PlayerNetworkingComponent.is_local_authority()) + \
" -> " + str($CharacterMovementComponent.input_direction)
func get_animation() -> String:
return $AnimationTree.get("parameters/Transition/current_state") + \
", " + str($AnimationTree.get("parameters/InAir/blend_amount")) + \
", active:" + str($AnimationTree.is_active()) + \
", " + str($AnimationPlayer.get_current_animation()) + \
", " + str($AnimationPlayer.get_current_animation_position()) + \
", " + str($AnimationPlayer.get_autoplay()) + \
", playing:" + str($AnimationPlayer.is_playing()) + \
", " + str($AnimationTree.get("parameters/Transition/current_state")) + \
", " + str($AnimationTree.get("parameters/Transition/current_index"))
", " + str($AnimationTree.get("parameters/InAir/blend_amount"))
# return $AnimationTree.get("parameters/Transition/current_state") + \
# ", " + str($AnimationTree.get("parameters/InAir/blend_amount")) + \
# ", active:" + str($AnimationTree.is_active()) + \
# ", " + str($AnimationPlayer.get_current_animation()) + \
# ", " + str($AnimationPlayer.get_current_animation_position()) + \
# ", " + str($AnimationPlayer.get_autoplay()) + \
# ", playing:" + str($AnimationPlayer.is_playing()) + \
# ", " + str($AnimationTree.get("parameters/Transition/current_state")) + \
# ", " + str($AnimationTree.get("parameters/Transition/current_index"))
func get_gait() -> String:
@ -97,3 +127,13 @@ func get_rotation_mode() -> String:
func get_movement_state() -> String:
return Global.MOVEMENT_STATE.keys()[$CharacterMovementComponent.movement_state]
#
func _process(_delta):
if ! $PlayerNetworkingComponent.is_local_authority():
if get_my_rotation() != save_rot:
print("Ohhhhhh : " + str( get_my_rotation()) + " != " + str(save_rot))
print("Ohhhhhh")
else:
print("Superrrr")
# $Armature.set_global_rotation(save_rot)

View file

@ -443,43 +443,43 @@ bones/0/name = "Hips"
bones/0/parent = -1
bones/0/rest = Transform3D(0.544576, -0.0348814, -0.837986, 0.0102475, 0.999337, -0.0349382, 0.838649, 0.0104393, 0.544573, -0.000172998, 0.901879, -0.00179914)
bones/0/enabled = true
bones/0/position = Vector3(0.00465144, 0.929363, -0.0051697)
bones/0/rotation = Quaternion(-0.0394692, -0.367225, -0.0147558, 0.929177)
bones/0/position = Vector3(-0.00176314, 0.931469, -0.000860252)
bones/0/rotation = Quaternion(-0.0401286, -0.36795, -0.01318, 0.928886)
bones/0/scale = Vector3(1, 1, 1)
bones/1/name = "Spine"
bones/1/parent = 0
bones/1/rest = Transform3D(0.99963, -0.0129189, 0.0239171, 0.01122, 0.997494, 0.0698543, -0.0247596, -0.0695601, 0.99727, 4.88944e-09, 0.0992349, -0.0122733)
bones/1/enabled = true
bones/1/position = Vector3(4.88944e-09, 0.0992349, -0.0122733)
bones/1/rotation = Quaternion(-0.0114734, 0.0403703, -0.00568826, 0.999103)
bones/1/rotation = Quaternion(-0.0133893, 0.0404415, -0.00578242, 0.999075)
bones/1/scale = Vector3(1, 1, 1)
bones/2/name = "Spine1"
bones/2/parent = 1
bones/2/rest = Transform3D(0.99985, -0.015446, 0.00786788, 0.0155655, 0.999761, -0.0153596, -0.00762876, 0.0154798, 0.999851, -2.79397e-09, 0.11732, 1.86265e-09)
bones/2/enabled = true
bones/2/position = Vector3(-2.79397e-09, 0.11732, 1.86265e-09)
bones/2/rotation = Quaternion(0.0984863, 0.081927, -0.00777544, 0.99173)
bones/2/rotation = Quaternion(0.0938751, 0.0821744, -0.00781475, 0.992156)
bones/2/scale = Vector3(1, 1, 1)
bones/3/name = "Spine2"
bones/3/parent = 2
bones/3/rest = Transform3D(0.999844, -0.014346, 0.0103258, 0.0156141, 0.990645, -0.135571, -0.00828427, 0.135711, 0.990714, -2.79397e-09, 0.134588, -2.51457e-08)
bones/3/enabled = true
bones/3/position = Vector3(-2.79397e-09, 0.134588, -2.51457e-08)
bones/3/rotation = Quaternion(0.158146, 0.0813042, -0.0127239, 0.983981)
bones/3/rotation = Quaternion(0.154004, 0.0814804, -0.0128469, 0.984621)
bones/3/scale = Vector3(1, 1, 1)
bones/4/name = "Neck"
bones/4/parent = 3
bones/4/rest = Transform3D(0.968778, 0.12654, 0.213204, -0.00181599, 0.863542, -0.504273, -0.247921, 0.488142, 0.836811, 2.48197e-07, 0.150325, 0.00792907)
bones/4/enabled = true
bones/4/position = Vector3(2.48197e-07, 0.150325, 0.00792907)
bones/4/rotation = Quaternion(0.11929, -0.0104056, 0.0036508, 0.992798)
bones/4/rotation = Quaternion(0.129882, -0.00998771, 0.00324898, 0.991474)
bones/4/scale = Vector3(1, 1, 1)
bones/5/name = "Head"
bones/5/parent = 4
bones/5/rest = Transform3D(0.840773, 0.330252, 0.428993, -0.33245, 0.940342, -0.0723432, -0.427291, -0.0817944, 0.900406, 5.58794e-09, 0.107895, 5.21541e-08)
bones/5/enabled = true
bones/5/position = Vector3(5.58794e-09, 0.107895, 5.21541e-08)
bones/5/rotation = Quaternion(-0.0394857, 0.165949, -0.0646774, 0.983219)
bones/5/rotation = Quaternion(-0.0476332, 0.169489, -0.0573583, 0.982708)
bones/5/scale = Vector3(1, 1, 1)
bones/6/name = "HeadTop_End"
bones/6/parent = 5
@ -507,42 +507,42 @@ bones/9/parent = 3
bones/9/rest = Transform3D(-0.250988, 0.959361, -0.128958, 0.025503, -0.126623, -0.991623, -0.967654, -0.252174, 0.0073142, 0.0610582, 0.0911044, 0.00705553)
bones/9/enabled = true
bones/9/position = Vector3(0.0610582, 0.0911044, 0.00705553)
bones/9/rotation = Quaternion(-0.486829, -0.523397, 0.571439, -0.403126)
bones/9/rotation = Quaternion(-0.474143, -0.53506, 0.569819, -0.405224)
bones/9/scale = Vector3(1, 1, 1)
bones/10/name = "LeftArm"
bones/10/parent = 9
bones/10/rest = Transform3D(0.845869, -0.51692, -0.131522, 0.093338, 0.386222, -0.917671, 0.52516, 0.763954, 0.374941, 7.45058e-09, 0.129223, 3.95812e-08)
bones/10/enabled = true
bones/10/position = Vector3(7.45058e-09, 0.129223, 3.95812e-08)
bones/10/rotation = Quaternion(0.526397, -0.0806837, 0.144837, 0.833918)
bones/10/rotation = Quaternion(0.535645, -0.0750345, 0.146266, 0.828288)
bones/10/scale = Vector3(1, 1, 1)
bones/11/name = "LeftForeArm"
bones/11/parent = 10
bones/11/rest = Transform3D(0.138967, -0.989426, 0.0415226, 0.989436, 0.140472, 0.0358277, -0.0412816, 0.0361051, 0.998495, -4.47035e-08, 0.274229, -7.45058e-09)
bones/11/enabled = true
bones/11/position = Vector3(-4.47035e-08, 0.274229, -7.45058e-09)
bones/11/rotation = Quaternion(-0.0108031, 0.0933095, 0.445505, 0.890338)
bones/11/rotation = Quaternion(-0.0086432, 0.097867, 0.452429, 0.886372)
bones/11/scale = Vector3(1, 1, 1)
bones/12/name = "LeftHand"
bones/12/parent = 11
bones/12/rest = Transform3D(0.746359, -0.304314, 0.591895, 0.184003, 0.949028, 0.255908, -0.639601, -0.0820888, 0.764311, 6.0536e-09, 0.276326, -1.49012e-08)
bones/12/enabled = true
bones/12/position = Vector3(6.0536e-09, 0.276326, -1.49012e-08)
bones/12/rotation = Quaternion(-0.10815, 0.1212, -0.00774457, 0.986689)
bones/12/rotation = Quaternion(-0.152197, 0.123664, -0.00611043, 0.980564)
bones/12/scale = Vector3(1, 1, 1)
bones/13/name = "LeftHandMiddle1"
bones/13/parent = 12
bones/13/rest = Transform3D(0.98654, 0.118644, -0.112532, -0.118809, 0.0472127, -0.991794, -0.112357, 0.991814, 0.0606732, -3.12924e-07, 0.127755, -7.63685e-08)
bones/13/enabled = true
bones/13/position = Vector3(-3.12924e-07, 0.127755, -7.63685e-08)
bones/13/rotation = Quaternion(0.132869, 0.00449872, -0.0772619, 0.988107)
bones/13/rotation = Quaternion(0.138975, 0.00286881, -0.0698249, 0.987827)
bones/13/scale = Vector3(1, 1, 1)
bones/14/name = "LeftHandMiddle2"
bones/14/parent = 13
bones/14/rest = Transform3D(0.980685, 0.110739, -0.161229, -0.112737, -0.353585, -0.928584, -0.159838, 0.928824, -0.334271, -7.45058e-09, 0.0361397, -5.21541e-08)
bones/14/enabled = true
bones/14/position = Vector3(-7.45058e-09, 0.0361397, -5.21541e-08)
bones/14/rotation = Quaternion(0.196346, -0.00136218, 0.0150699, 0.980418)
bones/14/rotation = Quaternion(0.202539, -0.00139929, 0.0157619, 0.979146)
bones/14/scale = Vector3(1, 1, 1)
bones/15/name = "LeftHandMiddle3"
bones/15/parent = 14
@ -563,14 +563,14 @@ bones/17/parent = 12
bones/17/rest = Transform3D(0.922249, -0.296379, 0.248225, 0.374682, 0.843413, -0.385056, -0.0952333, 0.448123, 0.888885, -0.0300309, 0.0378879, 0.0216701)
bones/17/enabled = true
bones/17/position = Vector3(-0.0300309, 0.0378879, 0.0216701)
bones/17/rotation = Quaternion(0.28981, 0.11643, 0.176122, 0.933507)
bones/17/rotation = Quaternion(0.285978, 0.116984, 0.178578, 0.934153)
bones/17/scale = Vector3(1, 1, 1)
bones/18/name = "LeftHandThumb2"
bones/18/parent = 17
bones/18/rest = Transform3D(0.793061, 0.491162, -0.360297, -0.562049, 0.818065, -0.121947, 0.234851, 0.299216, 0.924832, 1.19209e-07, 0.0474499, -2.44938e-07)
bones/18/enabled = true
bones/18/position = Vector3(1.19209e-07, 0.0474499, -2.44938e-07)
bones/18/rotation = Quaternion(-0.00503378, 0.00130975, -0.00167169, 0.999985)
bones/18/rotation = Quaternion(-0.00667099, 0.000848215, -0.000823617, 0.999977)
bones/18/scale = Vector3(1, 1, 1)
bones/19/name = "LeftHandThumb3"
bones/19/parent = 18
@ -591,14 +591,14 @@ bones/21/parent = 12
bones/21/rest = Transform3D(0.983723, 0.142189, -0.109869, -0.119058, 0.0577917, -0.991204, -0.134589, 0.988151, 0.0737798, -0.0282207, 0.122666, 0.00231682)
bones/21/enabled = true
bones/21/position = Vector3(-0.0282207, 0.122666, 0.00231682)
bones/21/rotation = Quaternion(0.0547743, -0.00698368, 0.0618662, 0.996556)
bones/21/rotation = Quaternion(0.0416242, -0.0055579, 0.0615344, 0.997221)
bones/21/scale = Vector3(1, 1, 1)
bones/22/name = "LeftHandIndex2"
bones/22/parent = 21
bones/22/rest = Transform3D(0.978949, 0.10384, -0.175717, -0.111366, -0.44972, -0.8862, -0.171047, 0.887113, -0.428688, 1.11759e-07, 0.0389198, -5.96046e-08)
bones/22/enabled = true
bones/22/position = Vector3(1.11759e-07, 0.0389198, -5.96046e-08)
bones/22/rotation = Quaternion(0.15915, -0.00113891, -0.00484986, 0.987242)
bones/22/rotation = Quaternion(0.152414, -0.000968763, -0.00568409, 0.9883)
bones/22/scale = Vector3(1, 1, 1)
bones/23/name = "LeftHandIndex3"
bones/23/parent = 22
@ -619,14 +619,14 @@ bones/25/parent = 12
bones/25/rest = Transform3D(0.991492, 0.0540781, -0.118406, -0.118263, -0.00584495, -0.992965, -0.0543897, 0.99852, 0.000600219, 0.0221662, 0.12147, -9.90927e-05)
bones/25/enabled = true
bones/25/position = Vector3(0.0221662, 0.12147, -9.90927e-05)
bones/25/rotation = Quaternion(0.272804, -0.0161311, -0.122071, 0.954157)
bones/25/rotation = Quaternion(0.277807, -0.0191101, -0.114899, 0.953549)
bones/25/scale = Vector3(1, 1, 1)
bones/26/name = "LeftHandRing2"
bones/26/parent = 25
bones/26/rest = Transform3D(0.981497, 0.113181, -0.154445, -0.116659, -0.286137, -0.951061, -0.151835, 0.951481, -0.267639, -3.72529e-08, 0.036012, -1.11759e-07)
bones/26/enabled = true
bones/26/position = Vector3(-3.72529e-08, 0.036012, -1.11759e-07)
bones/26/rotation = Quaternion(0.28154, 0.00171336, 0.0247314, 0.959229)
bones/26/rotation = Quaternion(0.288056, 0.0017774, 0.0251217, 0.957282)
bones/26/scale = Vector3(1, 1, 1)
bones/27/name = "LeftHandRing3"
bones/27/parent = 26
@ -647,14 +647,14 @@ bones/29/parent = 12
bones/29/rest = Transform3D(0.991785, 0.0101279, -0.127516, -0.126197, -0.0855001, -0.988314, -0.0209122, 0.996287, -0.0835196, 0.0472581, 0.109082, 0.00226384)
bones/29/enabled = true
bones/29/position = Vector3(0.0472581, 0.109082, 0.00226384)
bones/29/rotation = Quaternion(0.298034, -0.0173312, -0.155825, 0.941591)
bones/29/rotation = Quaternion(0.302996, -0.0206488, -0.148694, 0.941094)
bones/29/scale = Vector3(1, 1, 1)
bones/30/name = "LeftHandPinky2"
bones/30/parent = 29
bones/30/rest = Transform3D(0.989305, 0.129006, -0.068066, -0.049097, -0.144898, -0.988228, -0.13735, 0.981001, -0.137015, -5.96046e-08, 0.0413669, -1.49012e-08)
bones/30/enabled = true
bones/30/position = Vector3(-5.96046e-08, 0.0413669, -1.49012e-08)
bones/30/rotation = Quaternion(0.342256, 0.0114697, 0.0499614, 0.938207)
bones/30/rotation = Quaternion(0.348753, 0.0117926, 0.0500271, 0.935804)
bones/30/scale = Vector3(1, 1, 1)
bones/31/name = "LeftHandPinky3"
bones/31/parent = 30
@ -675,42 +675,42 @@ bones/33/parent = 3
bones/33/rest = Transform3D(-0.214833, -0.949432, 0.228968, -0.0511495, -0.223182, -0.973434, 0.975311, -0.220837, -0.000616074, -0.061057, 0.0911053, 0.00705566)
bones/33/enabled = true
bones/33/position = Vector3(-0.061057, 0.0911053, 0.00705566)
bones/33/rotation = Quaternion(0.538261, -0.484035, 0.539411, 0.43014)
bones/33/rotation = Quaternion(0.527329, -0.494188, 0.539202, 0.432392)
bones/33/scale = Vector3(1, 1, 1)
bones/34/name = "RightArm"
bones/34/parent = 33
bones/34/rest = Transform3D(0.555382, 0.714901, -0.424814, -0.786414, 0.285417, -0.547804, -0.270377, 0.63832, 0.720724, -2.23517e-08, 0.129223, 9.12696e-08)
bones/34/enabled = true
bones/34/position = Vector3(-2.23517e-08, 0.129223, 9.12696e-08)
bones/34/rotation = Quaternion(0.517824, 0.0822025, 0.0777739, 0.847969)
bones/34/rotation = Quaternion(0.516222, 0.0816319, 0.07968, 0.848824)
bones/34/scale = Vector3(1, 1, 1)
bones/35/name = "RightForeArm"
bones/35/parent = 34
bones/35/rest = Transform3D(-0.491194, 0.870247, -0.0374029, -0.870282, -0.488505, 0.0630281, 0.0365786, 0.0635101, 0.997311, 7.45058e-09, 0.274776, -3.72529e-08)
bones/35/enabled = true
bones/35/position = Vector3(7.45058e-09, 0.274776, -3.72529e-08)
bones/35/rotation = Quaternion(0.0568088, -0.0569877, -0.428339, 0.900028)
bones/35/rotation = Quaternion(0.0639905, -0.0612774, -0.431069, 0.897959)
bones/35/scale = Vector3(1, 1, 1)
bones/36/name = "RightHand"
bones/36/parent = 35
bones/36/rest = Transform3D(0.953663, 0.121098, 0.275431, -0.18063, 0.962538, 0.202223, -0.240624, -0.242603, 0.939811, 7.45058e-09, 0.276868, 5.96046e-08)
bones/36/enabled = true
bones/36/position = Vector3(7.45058e-09, 0.276868, 5.96046e-08)
bones/36/rotation = Quaternion(0.110198, -0.0170778, -0.0644156, 0.991673)
bones/36/rotation = Quaternion(0.10697, -0.00384357, -0.0381328, 0.993523)
bones/36/scale = Vector3(1, 1, 1)
bones/37/name = "RightHandMiddle1"
bones/37/parent = 36
bones/37/rest = Transform3D(0.986308, -0.119644, 0.1135, 0.119813, 0.0469439, -0.991686, 0.113321, 0.991706, 0.060636, 3.50177e-07, 0.127755, -8.9407e-08)
bones/37/enabled = true
bones/37/position = Vector3(3.50177e-07, 0.127755, -8.9407e-08)
bones/37/rotation = Quaternion(0.111134, 0.00835184, 0.0255921, 0.993441)
bones/37/rotation = Quaternion(0.110639, 0.00839663, 0.0252213, 0.993505)
bones/37/scale = Vector3(1, 1, 1)
bones/38/name = "RightHandMiddle2"
bones/38/parent = 37
bones/38/rest = Transform3D(0.980361, -0.111685, 0.162538, 0.114835, -0.346749, -0.930902, 0.160328, 0.931285, -0.327114, 6.70552e-08, 0.0361398, -1.02445e-07)
bones/38/enabled = true
bones/38/position = Vector3(6.70552e-08, 0.0361398, -1.02445e-07)
bones/38/rotation = Quaternion(0.288914, 0.0015858, -0.0193864, 0.957157)
bones/38/rotation = Quaternion(0.309781, 0.00172124, -0.0213088, 0.950568)
bones/38/scale = Vector3(1, 1, 1)
bones/39/name = "RightHandMiddle3"
bones/39/parent = 38
@ -731,14 +731,14 @@ bones/41/parent = 36
bones/41/rest = Transform3D(0.940404, 0.29207, -0.174168, -0.340048, 0.811489, -0.475239, 0.00253238, 0.506143, 0.862446, 0.0300309, 0.037888, 0.0216703)
bones/41/enabled = true
bones/41/position = Vector3(0.0300309, 0.037888, 0.0216703)
bones/41/rotation = Quaternion(0.205042, 0.0226834, -0.229424, 0.951214)
bones/41/rotation = Quaternion(0.204513, 0.0233172, -0.230161, 0.951134)
bones/41/scale = Vector3(1, 1, 1)
bones/42/name = "RightHandThumb2"
bones/42/parent = 41
bones/42/rest = Transform3D(0.793791, -0.608189, -0.00159446, 0.595053, 0.777184, -0.204689, 0.125729, 0.161531, 0.978826, -1.2666e-07, 0.0474498, -2.68221e-07)
bones/42/enabled = true
bones/42/position = Vector3(-1.2666e-07, 0.0474498, -2.68221e-07)
bones/42/rotation = Quaternion(0.00305879, 0.00148167, 0.181074, 0.983464)
bones/42/rotation = Quaternion(0.00444348, 0.00194769, 0.181603, 0.98336)
bones/42/scale = Vector3(1, 1, 1)
bones/43/name = "RightHandThumb3"
bones/43/parent = 42
@ -759,14 +759,14 @@ bones/45/parent = 36
bones/45/rest = Transform3D(0.978763, -0.172845, 0.110213, 0.120904, 0.0525683, -0.991271, 0.165542, 0.983545, 0.0723496, 0.0282207, 0.122666, 0.00231693)
bones/45/enabled = true
bones/45/position = Vector3(0.0282207, 0.122666, 0.00231693)
bones/45/rotation = Quaternion(0.0468797, 0.0106206, 0.00603742, 0.998826)
bones/45/rotation = Quaternion(0.0390987, 0.0100155, 0.00896334, 0.999145)
bones/45/scale = Vector3(1, 1, 1)
bones/46/name = "RightHandIndex2"
bones/46/parent = 45
bones/46/rest = Transform3D(0.978593, -0.104714, 0.177172, 0.106914, -0.476935, -0.872412, 0.175853, 0.872679, -0.45553, 1.49012e-07, 0.0389196, -8.75443e-08)
bones/46/enabled = true
bones/46/position = Vector3(1.49012e-07, 0.0389196, -8.75443e-08)
bones/46/rotation = Quaternion(0.161051, 0.00048133, 0.00826029, 0.986911)
bones/46/rotation = Quaternion(0.146895, 0.000172339, 0.00970654, 0.989105)
bones/46/scale = Vector3(1, 1, 1)
bones/47/name = "RightHandIndex3"
bones/47/parent = 46
@ -787,14 +787,14 @@ bones/49/parent = 36
bones/49/rest = Transform3D(0.991829, -0.0281871, 0.124419, 0.122843, -0.0520322, -0.991061, 0.0344089, 0.998247, -0.0481446, -0.0221661, 0.12147, -9.89214e-05)
bones/49/enabled = true
bones/49/position = Vector3(-0.0221661, 0.12147, -9.89214e-05)
bones/49/rotation = Quaternion(0.200314, -0.00740604, 0.0665204, 0.977443)
bones/49/rotation = Quaternion(0.21073, -0.00647297, 0.0652739, 0.975341)
bones/49/scale = Vector3(1, 1, 1)
bones/50/name = "RightHandRing2"
bones/50/parent = 49
bones/50/rest = Transform3D(0.982662, -0.117406, 0.143498, 0.122607, -0.169092, -0.977944, 0.139081, 0.978583, -0.151765, -7.45058e-09, 0.036012, 0)
bones/50/enabled = true
bones/50/position = Vector3(-7.45058e-09, 0.036012, 0)
bones/50/rotation = Quaternion(0.332856, -0.0024453, -0.0352517, 0.942315)
bones/50/rotation = Quaternion(0.34329, -0.00251374, -0.036134, 0.938531)
bones/50/scale = Vector3(1, 1, 1)
bones/51/name = "RightHandRing3"
bones/51/parent = 50
@ -815,14 +815,14 @@ bones/53/parent = 36
bones/53/rest = Transform3D(0.989897, 0.0602255, 0.128364, 0.133612, -0.0931972, -0.986642, -0.0474579, 0.993824, -0.100302, -0.047258, 0.109082, 0.00226358)
bones/53/enabled = true
bones/53/position = Vector3(-0.047258, 0.109082, 0.00226358)
bones/53/rotation = Quaternion(0.208023, -0.0111833, 0.0923438, 0.973691)
bones/53/rotation = Quaternion(0.207993, -0.0111433, 0.0918038, 0.973749)
bones/53/scale = Vector3(1, 1, 1)
bones/54/name = "RightHandPinky2"
bones/54/parent = 53
bones/54/rest = Transform3D(0.983236, -0.118306, 0.138749, 0.122507, -0.134994, -0.983244, 0.135054, 0.983758, -0.118237, -2.98023e-08, 0.0413665, 4.24334e-08)
bones/54/enabled = true
bones/54/position = Vector3(-2.98023e-08, 0.0413665, 4.24334e-08)
bones/54/rotation = Quaternion(0.371406, -0.0132297, -0.0704919, 0.925696)
bones/54/rotation = Quaternion(0.379818, -0.0135726, -0.0710235, 0.922231)
bones/54/scale = Vector3(1, 1, 1)
bones/55/name = "RightHandPinky3"
bones/55/parent = 54
@ -843,28 +843,28 @@ bones/57/parent = 0
bones/57/rest = Transform3D(-0.919821, -0.336213, -0.202214, 0.264978, -0.912457, 0.311783, -0.289337, 0.233202, 0.928386, -0.0912445, -0.0665637, -0.000553781)
bones/57/enabled = true
bones/57/position = Vector3(-0.0912445, -0.0665637, -0.000553781)
bones/57/rotation = Quaternion(-0.124769, 0.0179631, 0.983469, 0.129997)
bones/57/rotation = Quaternion(-0.124878, 0.00654514, 0.983598, 0.12999)
bones/57/scale = Vector3(1, 1, 1)
bones/58/name = "RightLeg"
bones/58/parent = 57
bones/58/rest = Transform3D(0.997811, 0.0392429, -0.0532304, 0.00932048, 0.713425, 0.70067, 0.0654722, -0.699632, 0.711497, 4.84288e-08, 0.405994, 2.6077e-08)
bones/58/enabled = true
bones/58/position = Vector3(4.84288e-08, 0.405994, 2.6077e-08)
bones/58/rotation = Quaternion(-0.300078, 0.0733131, -0.0191001, 0.950902)
bones/58/rotation = Quaternion(-0.287314, 0.0749344, -0.01867, 0.954718)
bones/58/scale = Vector3(1, 1, 1)
bones/59/name = "RightFoot"
bones/59/parent = 58
bones/59/rest = Transform3D(0.96994, -0.122934, 0.210008, 0.229929, 0.180407, -0.95634, 0.0796801, 0.975879, 0.20325, -1.02445e-08, 0.42099, 9.31323e-09)
bones/59/enabled = true
bones/59/position = Vector3(-1.02445e-08, 0.42099, 9.31323e-09)
bones/59/rotation = Quaternion(0.595721, 0.0614663, 0.113526, 0.792748)
bones/59/rotation = Quaternion(0.594246, 0.0613319, 0.113691, 0.793841)
bones/59/scale = Vector3(1, 1, 1)
bones/60/name = "RightToeBase"
bones/60/parent = 59
bones/60/rest = Transform3D(0.999367, 6.43255e-05, 0.0355612, 0.0227211, 0.768109, -0.639916, -0.027356, 0.640319, 0.767622, -5.51563e-09, 0.16432, -1.09159e-07)
bones/60/enabled = true
bones/60/position = Vector3(-5.51563e-09, 0.16432, -1.09159e-07)
bones/60/rotation = Quaternion(0.354126, 0.0204142, 0.00400344, 0.934967)
bones/60/rotation = Quaternion(0.354057, 0.0195701, 0.00439821, 0.935009)
bones/60/scale = Vector3(1, 1, 1)
bones/61/name = "RightToe_End"
bones/61/parent = 60
@ -878,28 +878,28 @@ bones/62/parent = 0
bones/62/rest = Transform3D(-0.893651, 0.403296, 0.196826, -0.227377, -0.785047, 0.576195, 0.386895, 0.470164, 0.793258, 0.0912445, -0.0665636, -0.000553777)
bones/62/enabled = true
bones/62/position = Vector3(0.0912445, -0.0665636, -0.000553777)
bones/62/rotation = Quaternion(0.0777127, 0.2137, 0.968219, -0.104139)
bones/62/rotation = Quaternion(0.0799512, 0.205398, 0.969832, -0.104143)
bones/62/scale = Vector3(1, 1, 1)
bones/63/name = "LeftLeg"
bones/63/parent = 62
bones/63/rest = Transform3D(0.99576, 0.0029921, 0.0919402, -0.056273, 0.810456, 0.583091, -0.0727688, -0.585792, 0.807188, 5.12227e-08, 0.405994, -2.04891e-08)
bones/63/enabled = true
bones/63/position = Vector3(5.12227e-08, 0.405994, -2.04891e-08)
bones/63/rotation = Quaternion(-0.310692, 0.120739, -0.0382815, 0.942034)
bones/63/rotation = Quaternion(-0.304747, 0.121903, -0.0383145, 0.943823)
bones/63/scale = Vector3(1, 1, 1)
bones/64/name = "LeftFoot"
bones/64/parent = 63
bones/64/rest = Transform3D(0.977802, 0.128039, -0.165856, -0.209522, 0.59104, -0.778956, -0.00170929, 0.796415, 0.604748, -2.04891e-08, 0.42099, 6.98492e-09)
bones/64/enabled = true
bones/64/position = Vector3(-2.04891e-08, 0.42099, 6.98492e-09)
bones/64/rotation = Quaternion(0.487092, -0.0216807, -0.0391932, 0.872202)
bones/64/rotation = Quaternion(0.488985, -0.0220482, -0.0397986, 0.871105)
bones/64/scale = Vector3(1, 1, 1)
bones/65/name = "LeftToeBase"
bones/65/parent = 64
bones/65/rest = Transform3D(0.999367, -0.000945242, -0.0355486, -0.0227206, 0.752033, -0.658734, 0.0273564, 0.659125, 0.751536, 3.66616e-08, 0.16432, -1.10293e-07)
bones/65/enabled = true
bones/65/position = Vector3(3.66616e-08, 0.16432, -1.10293e-07)
bones/65/rotation = Quaternion(0.358136, 0.00115284, -0.0287071, 0.933227)
bones/65/rotation = Quaternion(0.359775, -0.00302751, -0.0293221, 0.932573)
bones/65/scale = Vector3(1, 1, 1)
bones/66/name = "LeftToe_End"
bones/66/parent = 65
@ -918,7 +918,7 @@ mesh = SubResource("ArrayMesh_ludfp")
skin = SubResource("Skin_0b2ap")
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D"]
transform = Transform3D(0.997703, -0.0651011, 0.0187331, 0.0649426, 0.840481, -0.537934, 0.0192755, 0.537915, 0.842779, -0.0171964, 1.49725, 0.111914)
transform = Transform3D(0.996896, -0.0754271, 0.0225785, 0.0761161, 0.849939, -0.521355, 0.020134, 0.521455, 0.853041, -0.021665, 1.50102, 0.110944)
bone_name = "Head"
bone_idx = 5

View file

@ -22,16 +22,19 @@ func _process(_delta):
$TabContainer/Perso/VBoxContainer/HBoxContainer/Count.set_text(str(node_players.get_child_count()))
$TabContainer/Perso/VBoxContainer/HBoxContainer2/Id.set_text(str(Multi.get_id()))
if node_players.get_child_count() > 0:
$TabContainer/Network/VBoxContainer/players/player0.set_text(str(node_players.get_child(0).get_global_position()))
print(str(node_players.get_child(0).get_global_position()))
var info:String = str(node_players.get_child(0).get_my_position()) + "\n" + str(node_players.get_child(0).get_my_rotation()) + "\n" + str(node_players.get_child(0).get_comment())
$TabContainer/Network/VBoxContainer/players/player0.set_text(info)
#print(str(node_players.get_child(0).get_my_position()) + " - " + str(node_players.get_child(0).get_my_rotation()) )
if node_me:
$TabContainer/Network/VBoxContainer/me/me.set_text(str(node_me.get_child(0).get_global_position()))
var info:String = str(node_me.get_child(0).get_my_position()) + " - " + str(node_me.get_child(0).get_my_rotation())
$TabContainer/Network/VBoxContainer/me/me.set_text(info)
var tmp:String = ""
tmp += "Anim: " + str(node_me.get_child(0).get_animation())
tmp += "\nGait: " + node_me.get_child(0).get_gait()
tmp += "\nStance: " + node_me.get_child(0).get_stance()
tmp += "\nRotation: " + node_me.get_child(0).get_rotation_mode()
tmp += "\nMovement: " + node_me.get_child(0).get_movement_state()
tmp += "\nComment:" + node_me.get_child(0).get_comment()
$TabContainer/Network/VBoxContainer/state/state.set_text(tmp)

View file

@ -17,7 +17,6 @@ grow_horizontal = 2
grow_vertical = 2
[node name="Perso" type="TabBar" parent="TabContainer"]
visible = false
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Perso"]
@ -55,6 +54,7 @@ size_flags_horizontal = 3
text = "0"
[node name="Network" type="TabBar" parent="TabContainer"]
visible = false
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Network"]

View file

@ -158,7 +158,7 @@ func get_event_received():
if mid == id:
#print("Me id:", mid, " x:", mx, " y:", my, " z:", mz)
continue
#print("pos:", pos, " id:", mid, " x:", mx, " y:", my, " z:", mz, " rx:", rx, " ry:", ry, " rz:", rz)
print("pos:", pos, " id:", mid, " x:", mx, " y:", my, " z:", mz, " rx:", rx, " ry:", ry, " rz:", rz)
update_player_position.emit(mid, Vector3(mx, my, mz), Vector3(rx, ry, rz))
var nbuserremove:int = data[pos]
pos += 1

View file

@ -896,7 +896,7 @@ fn main() -> anyhow::Result<()> {
let y = ybytes.read_f64::<LittleEndian>().unwrap();
let mut zbytes: &[u8] = &packet.data()[16..24];
let z = zbytes.read_f64::<LittleEndian>().unwrap();
let mut rxbytes: &[u8] = &packet.data()[16..32];
let mut rxbytes: &[u8] = &packet.data()[24..32];
let rx = rxbytes.read_f64::<LittleEndian>().unwrap();
let mut rybytes: &[u8] = &packet.data()[32..40];
let ry = rybytes.read_f64::<LittleEndian>().unwrap();