Merge branch 'player'

This commit is contained in:
AleaJactaEst 2023-12-12 18:29:50 +01:00
commit 40d8cc0318
15 changed files with 843 additions and 229 deletions

View file

@ -22,6 +22,12 @@ func _physics_process(_delta):
pass pass
Global.MOVEMENT_STATE.RAGDOLL: Global.MOVEMENT_STATE.RAGDOLL:
pass pass
if !movement_script.input_is_moving:
set("parameters/Transition/transition_request","Idle")
Global.msg_info("Idle", [])
elif movement_script.gait == Global.GAIT.WALKING and movement_script.input_is_moving:
set("parameters/Transition/transition_request","WalkForward")
Global.msg_info("Walk", [])
#set("parameters/Transition/transition_request","Idle") #set("parameters/Transition/transition_request","Idle")
#set("parameters/InAir/blend_amount" , 0.5) #set("parameters/InAir/blend_amount" , 0.5)

View file

@ -1,6 +1,7 @@
extends Node extends Node
class_name CharacterMovementComponent class_name CharacterMovementComponent
signal start_jump(vertical_velocity:Vector3)
##################################### #####################################
@export_category("References") @export_category("References")
@ -117,7 +118,7 @@ var input_acceleration :Vector3
var input_direction:Vector3 var input_direction:Vector3
var vertical_velocity :Vector3 var vertical_velocity :Vector3
## returns the actual velocity for the player. ## returns the actual velocity for the player.
## so for example if player is holding forward key, but character is stuck by wall, it will return 0 velocity. ## so for example if player is holding forward key, but character is stuck by wall, it will return 0 velocity.
@ -314,18 +315,22 @@ var pose_warping_instance = PoseWarping.new()
func _process(delta): func _process(delta):
Global.msg_info("delta: %f", [delta])
calc_animation_data() calc_animation_data()
var orientation_warping_condition = rotation_mode != Global.ROTATION_MODE.VELOCITY_DIRECTION and \ var orientation_warping_condition = rotation_mode != Global.ROTATION_MODE.VELOCITY_DIRECTION and \
movement_state == Global.MOVEMENT_STATE.GROUNDED and \ movement_state == Global.MOVEMENT_STATE.GROUNDED and \
movement_action == Global.MOVEMENT_ACTION.NONE and \ movement_action == Global.MOVEMENT_ACTION.NONE and \
gait != Global.GAIT.SPRINTING and \ gait != Global.GAIT.SPRINTING and \
input_is_moving input_is_moving
Global.msg_info("orientation_warping_condition:%s", [str(orientation_warping_condition)])
pose_warping_instance.orientation_warping( orientation_warping_condition,camera_root.HObject,animation_velocity,skeleton_ref,"Hips",["Spine","Spine1","Spine2"],0.0,delta) 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): func _physics_process(delta):
#Debug() #Debug()
# #
Global.msg_info("delta: %f", [delta])
aim_rate_h = abs((camera_root.HObject.rotation.y - previous_aim_rate_h) / delta) aim_rate_h = abs((camera_root.HObject.rotation.y - previous_aim_rate_h) / delta)
previous_aim_rate_h = camera_root.HObject.rotation.y previous_aim_rate_h = camera_root.HObject.rotation.y
# #
@ -377,7 +382,16 @@ func _physics_process(delta):
#------------------ Gravity ------------------# #------------------ Gravity ------------------#
if is_flying == false and character_node is CharacterBody3D: if is_flying == false and character_node is CharacterBody3D:
character_node.velocity.y = lerp(character_node.velocity.y,vertical_velocity.y - character_node.get_floor_normal().y,delta * gravity) 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() Global.msg_info("ID:%d velocity:%s", [character_node.get_node("PlayerNetworkingComponent").id, str(character_node.velocity)])
var collided = character_node.move_and_slide()
Global.msg_info("ID:%d velocity:%s collided:%s" , [character_node.get_node("PlayerNetworkingComponent").id, str(character_node.velocity), str(collided)])
if character_node.velocity.x * character_node.velocity.x + character_node.velocity.z * character_node.velocity.z > 0.5:
input_is_moving = true
Global.msg_info("ID:%d distance^2:%s true", [character_node.get_node("PlayerNetworkingComponent").id, str(character_node.velocity.x * character_node.velocity.x + character_node.velocity.z * character_node.velocity.z )])
else:
input_is_moving = false
Global.msg_info("ID:%d distance^2:%s false", [character_node.get_node("PlayerNetworkingComponent").id, str(character_node.velocity.x * character_node.velocity.x + character_node.velocity.z * character_node.velocity.z )])
if ground_check.is_colliding() and is_flying == false: if ground_check.is_colliding() and is_flying == false:
movement_state = Global.MOVEMENT_STATE.GROUNDED movement_state = Global.MOVEMENT_STATE.GROUNDED
else: else:
@ -570,18 +584,22 @@ func add_movement_input(direction: Vector3 = Vector3.ZERO, Speed: float = 0, Acc
if is_flying == false: if is_flying == false:
character_node.velocity.x = lerp(character_node.velocity.x,(direction*max_speed).x,Acceleration/(max_speed if max_speed != 0 else (abs(character_node.velocity.x) if character_node.velocity.x != 0 else 1.0))*get_physics_process_delta_time()) character_node.velocity.x = lerp(character_node.velocity.x,(direction*max_speed).x,Acceleration/(max_speed if max_speed != 0 else (abs(character_node.velocity.x) if character_node.velocity.x != 0 else 1.0))*get_physics_process_delta_time())
character_node.velocity.z = lerp(character_node.velocity.z,(direction*max_speed).z,Acceleration/(max_speed if max_speed != 0 else (abs(character_node.velocity.z) if character_node.velocity.z != 0 else 1.0))*get_physics_process_delta_time()) character_node.velocity.z = lerp(character_node.velocity.z,(direction*max_speed).z,Acceleration/(max_speed if max_speed != 0 else (abs(character_node.velocity.z) if character_node.velocity.z != 0 else 1.0))*get_physics_process_delta_time())
Global.msg_info("ID:%d velocity:%s", [character_node.get_node("PlayerNetworkingComponent").id, str(character_node.velocity)])
else: else:
character_node.velocity = character_node.velocity.lerp((direction*max_speed),Acceleration/(max_speed if max_speed != 0 else character_node.velocity.x if character_node.velocity.x != 0 else 1.0)*get_physics_process_delta_time()) character_node.velocity = character_node.velocity.lerp((direction*max_speed),Acceleration/(max_speed if max_speed != 0 else character_node.velocity.x if character_node.velocity.x != 0 else 1.0)*get_physics_process_delta_time())
character_node.move_and_slide() var body_collided = character_node.move_and_slide()
Global.msg_info("ID:%d body_collided:%s", [character_node.get_node("PlayerNetworkingComponent").id, str(body_collided)])
# Get the velocity from the character node # Get the velocity from the character node
Global.msg_info("ID:%d velocity:%s", [character_node.get_node("PlayerNetworkingComponent").id, str(character_node.velocity)])
var character_node_velocity = character_node.velocity if character_node is CharacterBody3D else character_node.linear_velocity var character_node_velocity = character_node.velocity if character_node is CharacterBody3D else character_node.linear_velocity
input_velocity = direction*max_speed if character_node is CharacterBody3D else velocity input_velocity = direction*max_speed if character_node is CharacterBody3D else velocity
movement_direction = atan2(input_velocity.x,input_velocity.z) movement_direction = atan2(input_velocity.x,input_velocity.z)
input_is_moving = input_velocity.length() > 0.0 #input_is_moving = input_velocity.length() > 0.0
input_acceleration = Acceleration * direction * (1 if max_speed != 0 else -1) input_acceleration = Acceleration * direction * (1 if max_speed != 0 else -1)
Global.msg_info("ID:%d velocity:%s input_velocity:%s direction:%s input_acceleration:%s character_node_velocity:%s", [character_node.get_node("PlayerNetworkingComponent").id, str(character_node.velocity), str(input_velocity.length()), str(direction), str(input_acceleration), str(character_node_velocity)])
# #
actual_acceleration = (character_node_velocity - PrevVelocity) / (get_physics_process_delta_time()) actual_acceleration = (character_node_velocity - PrevVelocity) / (get_physics_process_delta_time())
PrevVelocity = character_node_velocity PrevVelocity = character_node_velocity
# #
@ -600,6 +618,7 @@ func add_movement_input(direction: Vector3 = Vector3.ZERO, Speed: float = 0, Acc
func calc_animation_data(): # it is used to modify the animation data to get the wanted animation result func calc_animation_data(): # it is used to modify the animation data to get the wanted animation result
Global.msg_info("actual_velocity:%s" , [str(actual_velocity)])
animation_is_moving_backward_relative_to_camera = false if -actual_velocity.rotated(Vector3.UP,-camera_root.HObject.transform.basis.get_euler().y).z >= -0.1 else true animation_is_moving_backward_relative_to_camera = false if -actual_velocity.rotated(Vector3.UP,-camera_root.HObject.transform.basis.get_euler().y).z >= -0.1 else true
animation_velocity = actual_velocity animation_velocity = actual_velocity
# a method to make the character' anim walk backward when moving left # a method to make the character' anim walk backward when moving left
@ -617,5 +636,6 @@ func jump() -> void:
character_node.apply_impulse(Vector3.UP * jump_magnitude * character_node.mass) character_node.apply_impulse(Vector3.UP * jump_magnitude * character_node.mass)
else: else:
vertical_velocity = Vector3.UP * jump_magnitude vertical_velocity = Vector3.UP * jump_magnitude
start_jump.emit(vertical_velocity)

View file

@ -1,5 +1,38 @@
extends Node extends Node
signal update_message(message)
@export var debug_console:bool = false:
get: return debug_console
set(value):
debug_console = value
@export var debug_app:bool = false:
get: return debug_app
set(value):
debug_app = value
@export var verbose_console:bool = false:
get: return verbose_console
set(value):
verbose_console = value
@export var verbose_app:bool = false:
get: return verbose_app
set(value):
verbose_app = value
@export var error_console:bool = false:
get: return error_console
set(value):
error_console = value
@export var error_app:bool = false:
get: return error_app
set(value):
error_app = value
#------------------ Player Enums ------------------# #------------------ Player Enums ------------------#
# Demarche (Attend, Marche, Cours, sprint # Demarche (Attend, Marche, Cours, sprint
enum GAIT {WAITING, WALKING , RUNNING , SPRINTING} enum GAIT {WAITING, WALKING , RUNNING , SPRINTING}
@ -26,3 +59,49 @@ enum MOVEMENT_DIRECTION {FORWARD , RIGHT, LEFT, BACKWARD}
func map_range_clamped(value,InputMin,InputMax,OutputMin,OutputMax): func map_range_clamped(value,InputMin,InputMax,OutputMin,OutputMax):
value = clamp(value,InputMin,InputMax) value = clamp(value,InputMin,InputMax)
return ((value - InputMin) / (InputMax - InputMin) * (OutputMax - OutputMin) + OutputMin) return ((value - InputMin) / (InputMax - InputMin) * (OutputMax - OutputMin) + OutputMin)
func get_time_text() -> String:
var time = Time.get_datetime_dict_from_system()
return "%s/%02d/%02d %02d:%02d:%02d" % [
time['year'], time['month'], time['day'],
time['hour'], time['minute'], time['second'],
]
func get_time_only_text() -> String:
var time = Time.get_datetime_dict_from_system()
return "%02d:%02d:%02d" % [
time['hour'], time['minute'], time['second'],
]
func send_message_console(severity:String, format_string:String, array_text:Array) -> void:
var formattage = "%s %s [%s:%d] " + format_string
var frame = get_stack()[2]
var param = [get_time_text(), severity, frame.source, frame.line]
param.append_array(array_text)
print( formattage % param )
func send_message_app(severity:String, format_string:String, array_text:Array) -> void:
var formattage = "%s %s [%s:%d] " + format_string
var frame = get_stack()[2]
var param = [get_time_text(), severity, frame.source, frame.line]
param.append_array(array_text)
update_message.emit(formattage % param)
func msg_debug(format_string:String, array_text:Array) -> void:
if debug_console:
send_message_console("DEBUG", format_string, array_text)
if debug_app:
send_message_app("DEBUG", format_string, array_text)
func msg_info(format_string:String, array_text:Array) -> void:
if verbose_console:
send_message_console("INFO", format_string, array_text)
if verbose_app:
send_message_app("INFO", format_string, array_text)
func msg_error(format_string:String, array_text:Array) -> void:
if error_console:
send_message_console("ERROR", format_string, array_text)
if error_app:
send_message_app("ERROR", format_string, array_text)

View file

@ -49,6 +49,7 @@ func _physics_process(_delta):
direction = Vector3(Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left"), direction = Vector3(Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left"),
remap(v_rotation,-PI/2,PI/2,-1.0,1.0) if character_component.is_flying == true else 0.0, 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")) Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up"))
Global.msg_debug("h_rotation:%s", [str(h_rotation)])
direction = direction.rotated(Vector3.UP,h_rotation).normalized() 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) character_component.add_movement_input(direction, character_component.current_movement_data.sprint_speed,character_component.current_movement_data.sprint_acceleration)

View file

@ -1,27 +1,24 @@
extends Node extends Node
class_name PlayerNetworkingComponent class_name PlayerNetworkingComponent
@export var character_movement_component : NodePath #@export var character_movement_component : NodePath
@onready var PlayerRef = get_node(character_movement_component) #@onready var player_ref = get_node(character_movement_component)
## Refrence to character mesh, should be assigned to a [Node3D] that is a parent to the actual mesh (Skeleton3D)
@export var mesh_ref : Node
## Refrence to a [RayCast3D] that should detect if character is on ground
@export var ground_check : RayCast3D
## Reference to Object CharacterMovementComponent
@export var character_movement_component : CharacterMovementComponent
## Reference Player
@export var player_ref:CharacterBody3D
var sync_camera_h_transform : Transform3D var tick:int = 0
var sync_camera_v_transform : Transform3D var jump:Vector3 = Vector3(0.0, 0.0, 0.0)
var sync_view_mode : Global.VIEW_MODE = Global.VIEW_MODE.THIRD_PERSON var tickjump: int = 0
var sync_CameraHOffset : float
var sync_position : Vector3: var target_pos:Vector3 = Vector3(0.0, 0.0, 0.0)
set(value): var target_rot:Vector3 = Vector3(0.0, 0.0, 0.0)
sync_position = value var target_vol:Vector3 = Vector3(0.0, 0.0, 0.0)
processed_position = false
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_velocity : Vector3
var processed_position : bool
@export var id:int = 0: @export var id:int = 0:
@ -31,11 +28,6 @@ var processed_position : bool
id = value id = value
func _ready():
#$MultiplayerSynchronizer.set_multiplayer_authority(str(get_parent().name).to_int())
pass
func set_id(value:int) -> void: func set_id(value:int) -> void:
id = value id = value
@ -45,43 +37,143 @@ func is_local_authority() -> bool:
return true return true
else: else:
return id == Multi.get_id() return id == Multi.get_id()
#return str(get_parent().name).to_int() == Multi.get_id()
# if multiplayer.multiplayer_peer is OfflineMultiplayerPeer:
# return true
# else:
# return str(get_parent().name).to_int() == multiplayer.get_unique_id()
#sync player on clients #sync player on clients
func _physics_process(_delta): func _process(delta):
return if is_local_authority():
# if !is_local_authority(): return
# if not processed_position: var diffpos = target_pos - get_my_position()
# PlayerRef.character_node.position = sync_position if target_pos == get_my_position():
# processed_position = true Global.msg_info("delta:%f diffpos:%s", [delta, str(diffpos)])
# PlayerRef.mesh_ref.rotation = sync_mesh_rotation #character_movement_component.input_is_moving = false
# PlayerRef.input_direction = sync_direction return
# PlayerRef.gait = sync_gait else:
# PlayerRef.stance = sync_stance Global.msg_info("delta:%f target_pos:%s get_my_position:%s diffpos:%s", [delta, str(target_pos), str(get_my_position), str(diffpos)])
# PlayerRef.rotation_mode = sync_rotation_mode #character_movement_component.input_is_moving = true
# PlayerRef.camera_root.VObject.transform = sync_camera_v_transform var diffrot = target_rot - get_my_rotation()
# PlayerRef.camera_root.HObject.transform = sync_camera_h_transform var direction = Vector3(diffpos.x,
# PlayerRef.camera_root.view_mode = sync_CameraHOffset 0.0,
# PlayerRef.camera_root.CameraHOffset = sync_CameraHOffset diffpos.z)
# PlayerRef.movement_state = sync_movement_state #print(diffpos)
# PlayerRef.movement_action = sync_movement_action #var h_rotation = -diffrot.y
## PlayerRef.velocity = sync_velocity #print(diffrot,", ", target_rot , ", ", get_my_rotation())
# PlayerRef.input_is_moving = sync_input_is_moving # .get_euler().y
# return # var hh:Basis = Basis.from_scale(diffrot)
# sync_position = PlayerRef.character_node.position # var h_rotation = hh.get_euler().y
# sync_mesh_rotation = PlayerRef.mesh_ref.rotation # #print("hh:", hh, " -> ", h_rotation, " / ", diffrot)
# sync_direction = PlayerRef.input_direction # direction = direction.rotated(Vector3.UP,h_rotation).normalized()
# sync_gait = PlayerRef.gait #print("diffpos:", diffpos.x,", ", diffpos.z )
# sync_stance = PlayerRef.stance # if target_vol == Vector3(0.0, 0.0, 0.0):
# sync_rotation_mode = PlayerRef.rotation_mode # var diffrot = target_rot - get_my_rotation()
# sync_camera_h_transform = PlayerRef.camera_root.HObject.transform # var h_rotation = diffrot.y
# sync_camera_v_transform = PlayerRef.camera_root.VObject.transform # direction = direction.rotated(Vector3.UP,h_rotation) #.normalized()
# sync_movement_state = PlayerRef.movement_state # print(diffrot,", ", target_rot , ", ", get_my_rotation())
# sync_movement_action = PlayerRef.movement_action
# sync_input_is_moving = PlayerRef.input_is_moving # Rotation apply directly when we move the player on specific direction
# sync_view_mode = PlayerRef.camera_root.view_mode if character_movement_component.gait == Global.GAIT.SPRINTING :
# sync_CameraHOffset = PlayerRef.camera_root.CameraHOffset character_movement_component.add_movement_input(direction, character_movement_component.current_movement_data.sprint_speed,character_movement_component.current_movement_data.sprint_acceleration)
elif character_movement_component.gait == Global.GAIT.RUNNING:
character_movement_component.add_movement_input(direction, character_movement_component.current_movement_data.run_speed,character_movement_component.current_movement_data.run_acceleration)
else:
character_movement_component.add_movement_input(direction, character_movement_component.current_movement_data.walk_speed,character_movement_component.current_movement_data.walk_acceleration)
func get_my_position() -> Vector3:
#return $SpringArm3D/Camera3D.get_global_position()
return player_ref.get_global_position()
func get_my_rotation() -> Vector3:
return mesh_ref.get_global_rotation()
func set_first_position_player(ctick:int, pos:Vector3, rot:Vector3):
set_my_position(pos)
set_my_rotation(rot)
func update_player(ctick:int, pos:Vector3, rot:Vector3, extra:int, ctickjump:int, vel:Vector3):
#print(tick, " - ", ctick)
if tick != ctick:
#set_my_rotation(rot)
Global.msg_info("extra:%s ctickjump:%s tickjump:%s", [str(extra), str(ctickjump), str(tickjump)])
if extra & 1:
set_my_position_onlyground(pos)
if tickjump == ctickjump:
Global.msg_info("Already Jump", [])
return
tickjump = ctickjump - 1
character_movement_component.jump()
Global.msg_info("Go Jump", [])
elif tickjump == 0 or ground_check.is_colliding():
Global.msg_info("No Jump", [])
tickjump = 0
update_my_position(pos, rot)
#set_my_position(pos)
#set_my_rotation(rot)
else:
set_my_position_onlyground(pos)
Global.msg_info("Always Jump", [])
tick = ctick
func set_my_position(pos:Vector3):
player_ref.set_global_position(pos)
target_pos = pos
func set_my_position_onlyground(pos:Vector3):
var newpos:Vector3 = Vector3(pos.x, player_ref.get_global_position().y ,pos.z)
target_pos = newpos
#player_ref.set_global_position(newpos)
func set_my_rotation(rot:Vector3):
Global.msg_info("Update %s %s", [str(rot), str(mesh_ref.get_global_rotation())])
mesh_ref.set_global_rotation(rot)
#$CharacterMovementComponent.input_direction = rot
target_rot = rot
func update_my_position(pos:Vector3, rot:Vector3):
# if target_pos == pos:
# # input_is_moving
# character_movement_component.input_is_moving = false
# else:
# target_pos = pos
# character_movement_component.input_is_moving = true
target_pos = pos
target_rot = rot
# var diffpos = get_my_position() - pos
# var diffrot = get_my_rotation() - rot
# var direction = Vector3(diffpos.x,
# 0.0,
# diffpos.z)
# var h_rotation = 0.0 #diffrot.y
# direction = direction.rotated(Vector3.UP,h_rotation).normalized()
# if character_movement_component.gait == Global.GAIT.SPRINTING :
# character_movement_component.add_movement_input(direction, character_movement_component.current_movement_data.sprint_speed,character_movement_component.current_movement_data.sprint_acceleration)
# elif character_movement_component.gait == Global.GAIT.RUNNING:
# character_movement_component.add_movement_input(direction, character_movement_component.current_movement_data.run_speed,character_movement_component.current_movement_data.run_acceleration)
# else:
# character_movement_component.add_movement_input(direction, character_movement_component.current_movement_data.walk_speed,character_movement_component.current_movement_data.walk_acceleration)
# pass
func is_jump() -> bool:
return jump != Vector3( 0.0, 0.0, 0.0)
func get_jump() -> Vector3:
var ret:Vector3 = jump
jump = Vector3(0.0, 0.0, 0.0)
return ret
func get_tickjump() -> int:
return tickjump
func get_comment() -> String:
return ""
func start_jump(vertical_velocity:Vector3):
jump = vertical_velocity
tickjump += 1

View file

@ -17,7 +17,7 @@ var previous_direction : float
var orientation_direction : float var orientation_direction : float
var cleared_override : bool = true var cleared_override : bool = true
func orientation_warping(enabled:bool,CameraObject, Velocity:Vector3, skeleton_ref:Skeleton3D, Hip :String= "Hips", Spines :Array[String]= ["Spine","Spine1","Spine2"], Offset := 0.0, delta :float= 1.0, turn_rate :float= 10.0): func orientation_warping(enabled:bool,CameraObject, Velocity:Vector3, skeleton_ref:Skeleton3D, Hip :String= "Hips", Spines :Array[String]= ["Spine","Spine1","Spine2"], Offset := 0.0, delta :float= 1.0, turn_rate :float= 10.0):
print("orientation_warping:", enabled, Velocity)
if !enabled and !cleared_override: if !enabled and !cleared_override:
set_bone_y_rotation(skeleton_ref,Hip,0,false) set_bone_y_rotation(skeleton_ref,Hip,0,false)
for bone in Spines: for bone in Spines:
@ -25,6 +25,7 @@ func orientation_warping(enabled:bool,CameraObject, Velocity:Vector3, skeleton_r
cleared_override = true cleared_override = true
if is_equal_approx(Velocity.length(),0.0) or !enabled: if is_equal_approx(Velocity.length(),0.0) or !enabled:
return return
print("orientation_warping:", enabled, Velocity)
cleared_override = false cleared_override = false
var CameraAngle :Quaternion = Quaternion(Vector3(0,1,0),atan2(-CameraObject.transform.basis.z.z, -CameraObject.transform.basis.z.x)) var CameraAngle :Quaternion = Quaternion(Vector3(0,1,0),atan2(-CameraObject.transform.basis.z.z, -CameraObject.transform.basis.z.x))
var VelocityAngle :Quaternion = Quaternion(Vector3(0,1,0),atan2(Velocity.z, Velocity.x)) var VelocityAngle :Quaternion = Quaternion(Vector3(0,1,0),atan2(Velocity.z, Velocity.x))

View file

@ -11,7 +11,10 @@ var camrot_v:float = 0.0
@export var h_sensitivity:float = 0.5 @export var h_sensitivity:float = 0.5
@export var v_sensitivity:float = 0.5 @export var v_sensitivity:float = 0.5
var save_rot:Vector3 #var save_rot:Vector3
#var tick:int = 0
#var jump:Vector3 = Vector3(0.0, 0.0, 0.0)
#var tickjump: int = 0
# Get the gravity from the project settings to be synced with RigidBody nodes. # Get the gravity from the project settings to be synced with RigidBody nodes.
@ -36,6 +39,7 @@ func set_otherplayer(value:bool):
func _ready(): func _ready():
$SpringArm3D/Camera3D.set_current(false) $SpringArm3D/Camera3D.set_current(false)
set_process(false) set_process(false)
$CharacterMovementComponent.start_jump.connect(_on_start_jump)
# $CameraComponent.set_process(false) # $CameraComponent.set_process(false)
# $PlayerController.set_process(false) # $PlayerController.set_process(false)
# $PlayerNetworkingComponent.set_process(false) # $PlayerNetworkingComponent.set_process(false)
@ -48,29 +52,83 @@ func _ready():
#$PlayerGameplayComponent.update_animations() #$PlayerGameplayComponent.update_animations()
func _on_start_jump(vertical_velocity:Vector3):
$PlayerNetworkingComponent.start_jump(vertical_velocity)
func get_my_position() -> Vector3: func get_my_position() -> Vector3:
#return $SpringArm3D/Camera3D.get_global_position() return $PlayerNetworkingComponent.get_my_position()
return self.get_global_position() #return self.get_global_position()
func get_my_rotation() -> Vector3: func get_my_rotation() -> Vector3:
return $PlayerNetworkingComponent.get_my_rotation()
#return $SpringArm3D/Camera3D.get_global_rotation() #return $SpringArm3D/Camera3D.get_global_rotation()
#return $Armature/Skeleton3D.get_global_rotation() #return $Armature/Skeleton3D.get_global_rotation()
#print($Armature/Skeleton3D.get_global_rotation(), "---", $Armature.get_global_rotation()) #print($Armature/Skeleton3D.get_global_rotation(), "---", $Armature.get_global_rotation())
return $Armature.get_global_rotation() #return $Armature.get_global_rotation()
func set_my_position(pos:Vector3): func is_jump() -> bool:
self.set_global_position(pos) #return jump != Vector3( 0.0, 0.0, 0.0)
return $PlayerNetworkingComponent.is_jump()
func set_my_rotation(rot:Vector3): func get_jump() -> Vector3:
save_rot = rot # var ret:Vector3 = jump
print("Update ->" + str(rot)) # jump = Vector3(0.0, 0.0, 0.0)
$Armature.set_global_rotation(rot) # return ret
#$CharacterMovementComponent.input_direction = rot return $PlayerNetworkingComponent.get_jump()
pass
func get_tickjump() -> int:
# return tickjump
return $PlayerNetworkingComponent.get_tickjump()
func set_first_position_player(ctick:int, pos:Vector3, rot:Vector3):
# set_my_position(pos)
# set_my_rotation(rot)
$PlayerNetworkingComponent.set_first_position_player(ctick, pos, rot)
func update_player(ctick:int, pos:Vector3, rot:Vector3, extra:int, ctickjump:int, vel:Vector3):
$PlayerNetworkingComponent.update_player(ctick, pos, rot, extra, ctickjump, vel)
# #print(tick, " - ", ctick)
# if tick != ctick:
# #set_my_rotation(rot)
# print("extra:", extra, " ctickjump:", ctickjump, " tickjump:", tickjump)
# if extra & 1:
# set_my_position_onlyground(pos)
# if tickjump == ctickjump:
# print("Already Jump")
# return
# tickjump = ctickjump - 1
# $CharacterMovementComponent.jump()
# print("Go Jump")
# elif tickjump == 0 or $GroundCheck.is_colliding():
# print("No Jump")
# tickjump = 0
# set_my_position(pos)
# set_my_rotation(rot)
# else:
# #set_my_position_onlyground(pos)
# print("Always Jump")
# tick = ctick
#
#func set_my_position(pos:Vector3):
# self.set_global_position(pos)
#
#
#func set_my_position_onlyground(pos:Vector3):
# var newpos:Vector3 = Vector3(pos.x, self.get_global_position().y ,pos.z)
# self.set_global_position(newpos)
#
#func set_my_rotation(rot:Vector3):
# save_rot = rot
# print("Update ->" + str(rot), " ", $Armature.get_global_rotation())
# $Armature.set_global_rotation(rot)
# #$CharacterMovementComponent.input_direction = rot
# pass
func set_current_camera() -> void: func set_current_camera() -> void:
@ -94,7 +152,7 @@ func set_activate() -> void:
func get_comment() -> String: func get_comment() -> String:
return str(save_rot) + \ return $PlayerNetworkingComponent.get_comment() + \
" -> " + str($PlayerNetworkingComponent.is_local_authority()) + \ " -> " + str($PlayerNetworkingComponent.is_local_authority()) + \
" -> " + str($CharacterMovementComponent.input_direction) " -> " + str($CharacterMovementComponent.input_direction)
@ -128,12 +186,3 @@ func get_rotation_mode() -> String:
func get_movement_state() -> String: func get_movement_state() -> String:
return Global.MOVEMENT_STATE.keys()[$CharacterMovementComponent.movement_state] 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/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/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/enabled = true
bones/0/position = Vector3(-0.00176314, 0.931469, -0.000860252) bones/0/position = Vector3(0.00389837, 0.928049, -0.00602487)
bones/0/rotation = Quaternion(-0.0401286, -0.36795, -0.01318, 0.928886) bones/0/rotation = Quaternion(-0.0391011, -0.368189, -0.0150829, 0.928806)
bones/0/scale = Vector3(1, 1, 1) bones/0/scale = Vector3(1, 1, 1)
bones/1/name = "Spine" bones/1/name = "Spine"
bones/1/parent = 0 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/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/enabled = true
bones/1/position = Vector3(4.88944e-09, 0.0992349, -0.0122733) bones/1/position = Vector3(4.88944e-09, 0.0992349, -0.0122733)
bones/1/rotation = Quaternion(-0.0133893, 0.0404415, -0.00578242, 0.999075) bones/1/rotation = Quaternion(-0.0108726, 0.0404716, -0.00604346, 0.999103)
bones/1/scale = Vector3(1, 1, 1) bones/1/scale = Vector3(1, 1, 1)
bones/2/name = "Spine1" bones/2/name = "Spine1"
bones/2/parent = 1 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/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/enabled = true
bones/2/position = Vector3(-2.79397e-09, 0.11732, 1.86265e-09) bones/2/position = Vector3(-2.79397e-09, 0.11732, 1.86265e-09)
bones/2/rotation = Quaternion(0.0938751, 0.0821744, -0.00781475, 0.992156) bones/2/rotation = Quaternion(0.0997442, 0.082279, -0.00839495, 0.99157)
bones/2/scale = Vector3(1, 1, 1) bones/2/scale = Vector3(1, 1, 1)
bones/3/name = "Spine2" bones/3/name = "Spine2"
bones/3/parent = 2 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/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/enabled = true
bones/3/position = Vector3(-2.79397e-09, 0.134588, -2.51457e-08) bones/3/position = Vector3(-2.79397e-09, 0.134588, -2.51457e-08)
bones/3/rotation = Quaternion(0.154004, 0.0814804, -0.0128469, 0.984621) bones/3/rotation = Quaternion(0.159392, 0.081618, -0.0133636, 0.983745)
bones/3/scale = Vector3(1, 1, 1) bones/3/scale = Vector3(1, 1, 1)
bones/4/name = "Neck" bones/4/name = "Neck"
bones/4/parent = 3 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/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/enabled = true
bones/4/position = Vector3(2.48197e-07, 0.150325, 0.00792907) bones/4/position = Vector3(2.48197e-07, 0.150325, 0.00792907)
bones/4/rotation = Quaternion(0.129882, -0.00998771, 0.00324898, 0.991474) bones/4/rotation = Quaternion(0.114919, -0.010178, 0.00468797, 0.993312)
bones/4/scale = Vector3(1, 1, 1) bones/4/scale = Vector3(1, 1, 1)
bones/5/name = "Head" bones/5/name = "Head"
bones/5/parent = 4 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/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/enabled = true
bones/5/position = Vector3(5.58794e-09, 0.107895, 5.21541e-08) bones/5/position = Vector3(5.58794e-09, 0.107895, 5.21541e-08)
bones/5/rotation = Quaternion(-0.0476332, 0.169489, -0.0573583, 0.982708) bones/5/rotation = Quaternion(-0.0363743, 0.166472, -0.065152, 0.983219)
bones/5/scale = Vector3(1, 1, 1) bones/5/scale = Vector3(1, 1, 1)
bones/6/name = "HeadTop_End" bones/6/name = "HeadTop_End"
bones/6/parent = 5 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/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/enabled = true
bones/9/position = Vector3(0.0610582, 0.0911044, 0.00705553) bones/9/position = Vector3(0.0610582, 0.0911044, 0.00705553)
bones/9/rotation = Quaternion(-0.474143, -0.53506, 0.569819, -0.405224) bones/9/rotation = Quaternion(-0.490893, -0.51949, 0.572894, -0.401182)
bones/9/scale = Vector3(1, 1, 1) bones/9/scale = Vector3(1, 1, 1)
bones/10/name = "LeftArm" bones/10/name = "LeftArm"
bones/10/parent = 9 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/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/enabled = true
bones/10/position = Vector3(7.45058e-09, 0.129223, 3.95812e-08) bones/10/position = Vector3(7.45058e-09, 0.129223, 3.95812e-08)
bones/10/rotation = Quaternion(0.535645, -0.0750345, 0.146266, 0.828288) bones/10/rotation = Quaternion(0.522702, -0.0838034, 0.146062, 0.835718)
bones/10/scale = Vector3(1, 1, 1) bones/10/scale = Vector3(1, 1, 1)
bones/11/name = "LeftForeArm" bones/11/name = "LeftForeArm"
bones/11/parent = 10 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/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/enabled = true
bones/11/position = Vector3(-4.47035e-08, 0.274229, -7.45058e-09) bones/11/position = Vector3(-4.47035e-08, 0.274229, -7.45058e-09)
bones/11/rotation = Quaternion(-0.0086432, 0.097867, 0.452429, 0.886372) bones/11/rotation = Quaternion(-0.0124027, 0.0923965, 0.440783, 0.892759)
bones/11/scale = Vector3(1, 1, 1) bones/11/scale = Vector3(1, 1, 1)
bones/12/name = "LeftHand" bones/12/name = "LeftHand"
bones/12/parent = 11 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/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/enabled = true
bones/12/position = Vector3(6.0536e-09, 0.276326, -1.49012e-08) bones/12/position = Vector3(6.0536e-09, 0.276326, -1.49012e-08)
bones/12/rotation = Quaternion(-0.152197, 0.123664, -0.00611043, 0.980564) bones/12/rotation = Quaternion(-0.159065, 0.12474, -0.00591672, 0.979338)
bones/12/scale = Vector3(1, 1, 1) bones/12/scale = Vector3(1, 1, 1)
bones/13/name = "LeftHandMiddle1" bones/13/name = "LeftHandMiddle1"
bones/13/parent = 12 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/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/enabled = true
bones/13/position = Vector3(-3.12924e-07, 0.127755, -7.63685e-08) bones/13/position = Vector3(-3.12924e-07, 0.127755, -7.63685e-08)
bones/13/rotation = Quaternion(0.138975, 0.00286881, -0.0698249, 0.987827) bones/13/rotation = Quaternion(0.127762, 0.00538911, -0.0820117, 0.988394)
bones/13/scale = Vector3(1, 1, 1) bones/13/scale = Vector3(1, 1, 1)
bones/14/name = "LeftHandMiddle2" bones/14/name = "LeftHandMiddle2"
bones/14/parent = 13 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/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/enabled = true
bones/14/position = Vector3(-7.45058e-09, 0.0361397, -5.21541e-08) bones/14/position = Vector3(-7.45058e-09, 0.0361397, -5.21541e-08)
bones/14/rotation = Quaternion(0.202539, -0.00139929, 0.0157619, 0.979146) bones/14/rotation = Quaternion(0.192651, -0.00133348, 0.0146574, 0.981157)
bones/14/scale = Vector3(1, 1, 1) bones/14/scale = Vector3(1, 1, 1)
bones/15/name = "LeftHandMiddle3" bones/15/name = "LeftHandMiddle3"
bones/15/parent = 14 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/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/enabled = true
bones/17/position = Vector3(-0.0300309, 0.0378879, 0.0216701) bones/17/position = Vector3(-0.0300309, 0.0378879, 0.0216701)
bones/17/rotation = Quaternion(0.285978, 0.116984, 0.178578, 0.934153) bones/17/rotation = Quaternion(0.285273, 0.112836, 0.189884, 0.932648)
bones/17/scale = Vector3(1, 1, 1) bones/17/scale = Vector3(1, 1, 1)
bones/18/name = "LeftHandThumb2" bones/18/name = "LeftHandThumb2"
bones/18/parent = 17 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/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/enabled = true
bones/18/position = Vector3(1.19209e-07, 0.0474499, -2.44938e-07) bones/18/position = Vector3(1.19209e-07, 0.0474499, -2.44938e-07)
bones/18/rotation = Quaternion(-0.00667099, 0.000848215, -0.000823617, 0.999977) bones/18/rotation = Quaternion(-0.00753822, 0.000718374, -0.000678567, 0.999971)
bones/18/scale = Vector3(1, 1, 1) bones/18/scale = Vector3(1, 1, 1)
bones/19/name = "LeftHandThumb3" bones/19/name = "LeftHandThumb3"
bones/19/parent = 18 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/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/enabled = true
bones/21/position = Vector3(-0.0282207, 0.122666, 0.00231682) bones/21/position = Vector3(-0.0282207, 0.122666, 0.00231682)
bones/21/rotation = Quaternion(0.0416242, -0.0055579, 0.0615344, 0.997221) bones/21/rotation = Quaternion(0.0348681, -0.00576536, 0.0612172, 0.997499)
bones/21/scale = Vector3(1, 1, 1) bones/21/scale = Vector3(1, 1, 1)
bones/22/name = "LeftHandIndex2" bones/22/name = "LeftHandIndex2"
bones/22/parent = 21 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/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/enabled = true
bones/22/position = Vector3(1.11759e-07, 0.0389198, -5.96046e-08) bones/22/position = Vector3(1.11759e-07, 0.0389198, -5.96046e-08)
bones/22/rotation = Quaternion(0.152414, -0.000968763, -0.00568409, 0.9883) bones/22/rotation = Quaternion(0.144788, -0.000764184, -0.0066249, 0.98944)
bones/22/scale = Vector3(1, 1, 1) bones/22/scale = Vector3(1, 1, 1)
bones/23/name = "LeftHandIndex3" bones/23/name = "LeftHandIndex3"
bones/23/parent = 22 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/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/enabled = true
bones/25/position = Vector3(0.0221662, 0.12147, -9.90927e-05) bones/25/position = Vector3(0.0221662, 0.12147, -9.90927e-05)
bones/25/rotation = Quaternion(0.277807, -0.0191101, -0.114899, 0.953549) bones/25/rotation = Quaternion(0.267954, -0.0146211, -0.12692, 0.954923)
bones/25/scale = Vector3(1, 1, 1) bones/25/scale = Vector3(1, 1, 1)
bones/26/name = "LeftHandRing2" bones/26/name = "LeftHandRing2"
bones/26/parent = 25 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/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/enabled = true
bones/26/position = Vector3(-3.72529e-08, 0.036012, -1.11759e-07) bones/26/position = Vector3(-3.72529e-08, 0.036012, -1.11759e-07)
bones/26/rotation = Quaternion(0.288056, 0.0017774, 0.0251217, 0.957282) bones/26/rotation = Quaternion(0.278215, 0.00169665, 0.024531, 0.960204)
bones/26/scale = Vector3(1, 1, 1) bones/26/scale = Vector3(1, 1, 1)
bones/27/name = "LeftHandRing3" bones/27/name = "LeftHandRing3"
bones/27/parent = 26 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/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/enabled = true
bones/29/position = Vector3(0.0472581, 0.109082, 0.00226384) bones/29/position = Vector3(0.0472581, 0.109082, 0.00226384)
bones/29/rotation = Quaternion(0.302996, -0.0206488, -0.148694, 0.941094) bones/29/rotation = Quaternion(0.293867, -0.0155742, -0.160387, 0.942166)
bones/29/scale = Vector3(1, 1, 1) bones/29/scale = Vector3(1, 1, 1)
bones/30/name = "LeftHandPinky2" bones/30/name = "LeftHandPinky2"
bones/30/parent = 29 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/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/enabled = true
bones/30/position = Vector3(-5.96046e-08, 0.0413669, -1.49012e-08) bones/30/position = Vector3(-5.96046e-08, 0.0413669, -1.49012e-08)
bones/30/rotation = Quaternion(0.348753, 0.0117926, 0.0500271, 0.935804) bones/30/rotation = Quaternion(0.339094, 0.0113469, 0.0499297, 0.939358)
bones/30/scale = Vector3(1, 1, 1) bones/30/scale = Vector3(1, 1, 1)
bones/31/name = "LeftHandPinky3" bones/31/name = "LeftHandPinky3"
bones/31/parent = 30 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/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/enabled = true
bones/33/position = Vector3(-0.061057, 0.0911053, 0.00705566) bones/33/position = Vector3(-0.061057, 0.0911053, 0.00705566)
bones/33/rotation = Quaternion(0.527329, -0.494188, 0.539202, 0.432392) bones/33/rotation = Quaternion(0.545181, -0.477421, 0.54105, 0.426746)
bones/33/scale = Vector3(1, 1, 1) bones/33/scale = Vector3(1, 1, 1)
bones/34/name = "RightArm" bones/34/name = "RightArm"
bones/34/parent = 33 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/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/enabled = true
bones/34/position = Vector3(-2.23517e-08, 0.129223, 9.12696e-08) bones/34/position = Vector3(-2.23517e-08, 0.129223, 9.12696e-08)
bones/34/rotation = Quaternion(0.516222, 0.0816319, 0.07968, 0.848824) bones/34/rotation = Quaternion(0.508153, 0.0927225, 0.0794923, 0.852563)
bones/34/scale = Vector3(1, 1, 1) bones/34/scale = Vector3(1, 1, 1)
bones/35/name = "RightForeArm" bones/35/name = "RightForeArm"
bones/35/parent = 34 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/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/enabled = true
bones/35/position = Vector3(7.45058e-09, 0.274776, -3.72529e-08) bones/35/position = Vector3(7.45058e-09, 0.274776, -3.72529e-08)
bones/35/rotation = Quaternion(0.0639905, -0.0612774, -0.431069, 0.897959) bones/35/rotation = Quaternion(0.050896, -0.0446304, -0.427534, 0.901461)
bones/35/scale = Vector3(1, 1, 1) bones/35/scale = Vector3(1, 1, 1)
bones/36/name = "RightHand" bones/36/name = "RightHand"
bones/36/parent = 35 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/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/enabled = true
bones/36/position = Vector3(7.45058e-09, 0.276868, 5.96046e-08) bones/36/position = Vector3(7.45058e-09, 0.276868, 5.96046e-08)
bones/36/rotation = Quaternion(0.10697, -0.00384357, -0.0381328, 0.993523) bones/36/rotation = Quaternion(0.108232, -0.0212631, -0.0664199, 0.991677)
bones/36/scale = Vector3(1, 1, 1) bones/36/scale = Vector3(1, 1, 1)
bones/37/name = "RightHandMiddle1" bones/37/name = "RightHandMiddle1"
bones/37/parent = 36 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/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/enabled = true
bones/37/position = Vector3(3.50177e-07, 0.127755, -8.9407e-08) bones/37/position = Vector3(3.50177e-07, 0.127755, -8.9407e-08)
bones/37/rotation = Quaternion(0.110639, 0.00839663, 0.0252213, 0.993505) bones/37/rotation = Quaternion(0.111075, 0.00853949, 0.0245702, 0.993472)
bones/37/scale = Vector3(1, 1, 1) bones/37/scale = Vector3(1, 1, 1)
bones/38/name = "RightHandMiddle2" bones/38/name = "RightHandMiddle2"
bones/38/parent = 37 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/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/enabled = true
bones/38/position = Vector3(6.70552e-08, 0.0361398, -1.02445e-07) bones/38/position = Vector3(6.70552e-08, 0.0361398, -1.02445e-07)
bones/38/rotation = Quaternion(0.309781, 0.00172124, -0.0213088, 0.950568) bones/38/rotation = Quaternion(0.275223, 0.00146608, -0.0181236, 0.961208)
bones/38/scale = Vector3(1, 1, 1) bones/38/scale = Vector3(1, 1, 1)
bones/39/name = "RightHandMiddle3" bones/39/name = "RightHandMiddle3"
bones/39/parent = 38 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/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/enabled = true
bones/41/position = Vector3(0.0300309, 0.037888, 0.0216703) bones/41/position = Vector3(0.0300309, 0.037888, 0.0216703)
bones/41/rotation = Quaternion(0.204513, 0.0233172, -0.230161, 0.951134) bones/41/rotation = Quaternion(0.202969, 0.0244192, -0.227887, 0.951985)
bones/41/scale = Vector3(1, 1, 1) bones/41/scale = Vector3(1, 1, 1)
bones/42/name = "RightHandThumb2" bones/42/name = "RightHandThumb2"
bones/42/parent = 41 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/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/enabled = true
bones/42/position = Vector3(-1.2666e-07, 0.0474498, -2.68221e-07) bones/42/position = Vector3(-1.2666e-07, 0.0474498, -2.68221e-07)
bones/42/rotation = Quaternion(0.00444348, 0.00194769, 0.181603, 0.98336) bones/42/rotation = Quaternion(0.00486645, 0.00160173, 0.18191, 0.983302)
bones/42/scale = Vector3(1, 1, 1) bones/42/scale = Vector3(1, 1, 1)
bones/43/name = "RightHandThumb3" bones/43/name = "RightHandThumb3"
bones/43/parent = 42 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/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/enabled = true
bones/45/position = Vector3(0.0282207, 0.122666, 0.00231693) bones/45/position = Vector3(0.0282207, 0.122666, 0.00231693)
bones/45/rotation = Quaternion(0.0390987, 0.0100155, 0.00896334, 0.999145) bones/45/rotation = Quaternion(0.0391944, 0.00984211, 0.0102551, 0.999131)
bones/45/scale = Vector3(1, 1, 1) bones/45/scale = Vector3(1, 1, 1)
bones/46/name = "RightHandIndex2" bones/46/name = "RightHandIndex2"
bones/46/parent = 45 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/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/enabled = true
bones/46/position = Vector3(1.49012e-07, 0.0389196, -8.75443e-08) bones/46/position = Vector3(1.49012e-07, 0.0389196, -8.75443e-08)
bones/46/rotation = Quaternion(0.146895, 0.000172339, 0.00970654, 0.989105) bones/46/rotation = Quaternion(0.147248, 0.000201449, 0.0096723, 0.989052)
bones/46/scale = Vector3(1, 1, 1) bones/46/scale = Vector3(1, 1, 1)
bones/47/name = "RightHandIndex3" bones/47/name = "RightHandIndex3"
bones/47/parent = 46 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/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/enabled = true
bones/49/position = Vector3(-0.0221661, 0.12147, -9.89214e-05) bones/49/position = Vector3(-0.0221661, 0.12147, -9.89214e-05)
bones/49/rotation = Quaternion(0.21073, -0.00647297, 0.0652739, 0.975341) bones/49/rotation = Quaternion(0.193095, -0.00802056, 0.0665567, 0.978887)
bones/49/scale = Vector3(1, 1, 1) bones/49/scale = Vector3(1, 1, 1)
bones/50/name = "RightHandRing2" bones/50/name = "RightHandRing2"
bones/50/parent = 49 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/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/enabled = true
bones/50/position = Vector3(-7.45058e-09, 0.036012, 0) bones/50/position = Vector3(-7.45058e-09, 0.036012, 0)
bones/50/rotation = Quaternion(0.34329, -0.00251374, -0.036134, 0.938531) bones/50/rotation = Quaternion(0.326044, -0.00239119, -0.0346764, 0.944715)
bones/50/scale = Vector3(1, 1, 1) bones/50/scale = Vector3(1, 1, 1)
bones/51/name = "RightHandRing3" bones/51/name = "RightHandRing3"
bones/51/parent = 50 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/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/enabled = true
bones/53/position = Vector3(-0.047258, 0.109082, 0.00226358) bones/53/position = Vector3(-0.047258, 0.109082, 0.00226358)
bones/53/rotation = Quaternion(0.207993, -0.0111433, 0.0918038, 0.973749) bones/53/rotation = Quaternion(0.207052, -0.0111279, 0.0918627, 0.973944)
bones/53/scale = Vector3(1, 1, 1) bones/53/scale = Vector3(1, 1, 1)
bones/54/name = "RightHandPinky2" bones/54/name = "RightHandPinky2"
bones/54/parent = 53 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/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/enabled = true
bones/54/position = Vector3(-2.98023e-08, 0.0413665, 4.24334e-08) bones/54/position = Vector3(-2.98023e-08, 0.0413665, 4.24334e-08)
bones/54/rotation = Quaternion(0.379818, -0.0135726, -0.0710235, 0.922231) bones/54/rotation = Quaternion(0.354908, -0.0124523, -0.0694377, 0.932236)
bones/54/scale = Vector3(1, 1, 1) bones/54/scale = Vector3(1, 1, 1)
bones/55/name = "RightHandPinky3" bones/55/name = "RightHandPinky3"
bones/55/parent = 54 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/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/enabled = true
bones/57/position = Vector3(-0.0912445, -0.0665637, -0.000553781) bones/57/position = Vector3(-0.0912445, -0.0665637, -0.000553781)
bones/57/rotation = Quaternion(-0.124878, 0.00654514, 0.983598, 0.12999) bones/57/rotation = Quaternion(-0.124566, 0.0210016, 0.983558, 0.129059)
bones/57/scale = Vector3(1, 1, 1) bones/57/scale = Vector3(1, 1, 1)
bones/58/name = "RightLeg" bones/58/name = "RightLeg"
bones/58/parent = 57 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/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/enabled = true
bones/58/position = Vector3(4.84288e-08, 0.405994, 2.6077e-08) bones/58/position = Vector3(4.84288e-08, 0.405994, 2.6077e-08)
bones/58/rotation = Quaternion(-0.287314, 0.0749344, -0.01867, 0.954718) bones/58/rotation = Quaternion(-0.305176, 0.0720621, -0.0197872, 0.949359)
bones/58/scale = Vector3(1, 1, 1) bones/58/scale = Vector3(1, 1, 1)
bones/59/name = "RightFoot" bones/59/name = "RightFoot"
bones/59/parent = 58 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/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/enabled = true
bones/59/position = Vector3(-1.02445e-08, 0.42099, 9.31323e-09) bones/59/position = Vector3(-1.02445e-08, 0.42099, 9.31323e-09)
bones/59/rotation = Quaternion(0.594246, 0.0613319, 0.113691, 0.793841) bones/59/rotation = Quaternion(0.598038, 0.0613792, 0.11325, 0.791048)
bones/59/scale = Vector3(1, 1, 1) bones/59/scale = Vector3(1, 1, 1)
bones/60/name = "RightToeBase" bones/60/name = "RightToeBase"
bones/60/parent = 59 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/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/enabled = true
bones/60/position = Vector3(-5.51563e-09, 0.16432, -1.09159e-07) bones/60/position = Vector3(-5.51563e-09, 0.16432, -1.09159e-07)
bones/60/rotation = Quaternion(0.354057, 0.0195701, 0.00439821, 0.935009) bones/60/rotation = Quaternion(0.353885, 0.0205579, 0.00394168, 0.935055)
bones/60/scale = Vector3(1, 1, 1) bones/60/scale = Vector3(1, 1, 1)
bones/61/name = "RightToe_End" bones/61/name = "RightToe_End"
bones/61/parent = 60 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/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/enabled = true
bones/62/position = Vector3(0.0912445, -0.0665636, -0.000553777) bones/62/position = Vector3(0.0912445, -0.0665636, -0.000553777)
bones/62/rotation = Quaternion(0.0799512, 0.205398, 0.969832, -0.104143) bones/62/rotation = Quaternion(0.0778373, 0.215804, 0.967562, -0.105802)
bones/62/scale = Vector3(1, 1, 1) bones/62/scale = Vector3(1, 1, 1)
bones/63/name = "LeftLeg" bones/63/name = "LeftLeg"
bones/63/parent = 62 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/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/enabled = true
bones/63/position = Vector3(5.12227e-08, 0.405994, -2.04891e-08) bones/63/position = Vector3(5.12227e-08, 0.405994, -2.04891e-08)
bones/63/rotation = Quaternion(-0.304747, 0.121903, -0.0383145, 0.943823) bones/63/rotation = Quaternion(-0.314354, 0.12035, -0.038413, 0.940862)
bones/63/scale = Vector3(1, 1, 1) bones/63/scale = Vector3(1, 1, 1)
bones/64/name = "LeftFoot" bones/64/name = "LeftFoot"
bones/64/parent = 63 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/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/enabled = true
bones/64/position = Vector3(-2.04891e-08, 0.42099, 6.98492e-09) bones/64/position = Vector3(-2.04891e-08, 0.42099, 6.98492e-09)
bones/64/rotation = Quaternion(0.488985, -0.0220482, -0.0397986, 0.871105) bones/64/rotation = Quaternion(0.488526, -0.0219716, -0.0398565, 0.871361)
bones/64/scale = Vector3(1, 1, 1) bones/64/scale = Vector3(1, 1, 1)
bones/65/name = "LeftToeBase" bones/65/name = "LeftToeBase"
bones/65/parent = 64 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/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/enabled = true
bones/65/position = Vector3(3.66616e-08, 0.16432, -1.10293e-07) bones/65/position = Vector3(3.66616e-08, 0.16432, -1.10293e-07)
bones/65/rotation = Quaternion(0.359775, -0.00302751, -0.0293221, 0.932573) bones/65/rotation = Quaternion(0.35771, 0.00236595, -0.0283402, 0.9334)
bones/65/scale = Vector3(1, 1, 1) bones/65/scale = Vector3(1, 1, 1)
bones/66/name = "LeftToe_End" bones/66/name = "LeftToe_End"
bones/66/parent = 65 bones/66/parent = 65
@ -918,7 +918,7 @@ mesh = SubResource("ArrayMesh_ludfp")
skin = SubResource("Skin_0b2ap") skin = SubResource("Skin_0b2ap")
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D"] [node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D"]
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) transform = Transform3D(0.997696, -0.0650221, 0.0193827, 0.0651317, 0.837776, -0.542116, 0.0190112, 0.542129, 0.84008, -0.0180246, 1.49546, 0.113051)
bone_name = "Head" bone_name = "Head"
bone_idx = 5 bone_idx = 5
@ -970,9 +970,12 @@ UsingCrouchToggle = true
character_component = NodePath("../CharacterMovementComponent") character_component = NodePath("../CharacterMovementComponent")
networking = NodePath("../PlayerNetworkingComponent") networking = NodePath("../PlayerNetworkingComponent")
[node name="PlayerNetworkingComponent" type="Node" parent="."] [node name="PlayerNetworkingComponent" type="Node" parent="." node_paths=PackedStringArray("mesh_ref", "ground_check", "character_movement_component", "player_ref")]
script = ExtResource("6_uat01") script = ExtResource("6_uat01")
mesh_ref = NodePath("../Armature")
ground_check = NodePath("../GroundCheck")
character_movement_component = NodePath("../CharacterMovementComponent") character_movement_component = NodePath("../CharacterMovementComponent")
player_ref = NodePath("..")
[node name="CharacterMovementComponent" type="Node" parent="." node_paths=PackedStringArray("networking", "targeting_component", "mesh_ref", "anim_ref", "skeleton_ref", "collision_shape_ref", "camera_root", "character_node", "ground_check", "look_at_object")] [node name="CharacterMovementComponent" type="Node" parent="." node_paths=PackedStringArray("networking", "targeting_component", "mesh_ref", "anim_ref", "skeleton_ref", "collision_shape_ref", "camera_root", "character_node", "ground_check", "look_at_object")]
script = ExtResource("7_bwjer") script = ExtResource("7_bwjer")

View file

@ -10,10 +10,17 @@ extends Window
set(value): set(value):
node_me = value node_me = value
const MAX_MESSAGES_SHOW : int = 100
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass # Replace with function body. $TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/DConsole.button_pressed = Global.debug_console
$TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/VConsole.button_pressed = Global.verbose_console
$TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/EConsole.button_pressed = Global.error_console
$TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/DApplication.button_pressed = Global.debug_app
$TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/VApplication.button_pressed = Global.verbose_app
$TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/EApplication.button_pressed = Global.error_app
Global.update_message.connect(_update_messages)
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
@ -40,3 +47,45 @@ func _process(_delta):
func _on_close_requested(): func _on_close_requested():
hide() hide()
func _on_console_toggled(button_pressed):
Global.debug_console = button_pressed
func _on_application_toggled(button_pressed):
Global.debug_app = button_pressed
func _on_v_console_toggled(button_pressed):
Global.verbose_console = button_pressed
func _on_e_console_toggled(button_pressed):
Global.error_console = button_pressed
func _on_v_application_toggled(button_pressed):
Global.verbose_app = button_pressed
func _on_e_application_toggled(button_pressed):
Global.error_app = button_pressed
func _update_messages(message):
while $TabContainer/Log/VBoxContainer/TabContainer/Messages/ItemList.item_count >= MAX_MESSAGES_SHOW:
$TabContainer/Log/VBoxContainer/TabContainer/Messages/ItemList.remove_item(0)
$TabContainer/Log/VBoxContainer/TabContainer/Messages/ItemList.add_item(message)
func _on_item_list_gui_input(event) -> void:
""" copy to clipboard your selection (log) """
if event is InputEventKey:
if event.is_action_pressed("ui_copy"):
var tampon:String = ""
var next:String = ""
for item in $TabContainer/Log/VBoxContainer/TabContainer/Messages/ItemList.get_selected_items():
tampon += next + $TabContainer/Log/VBoxContainer/TabContainer/Messages/ItemList.get_item_text(item)
next = "\n"
DisplayServer.clipboard_set(tampon)

View file

@ -103,4 +103,90 @@ text = "anim"
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
[node name="Log" type="TabBar" parent="TabContainer"]
visible = false
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Log"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="TabContainer" type="TabContainer" parent="TabContainer/Log/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
[node name="Messages" type="TabBar" parent="TabContainer/Log/VBoxContainer/TabContainer"]
layout_mode = 2
[node name="ItemList" type="ItemList" parent="TabContainer/Log/VBoxContainer/TabContainer/Messages"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
select_mode = 1
allow_rmb_select = true
same_column_width = true
[node name="Config" type="TabBar" parent="TabContainer/Log/VBoxContainer/TabContainer"]
visible = false
layout_mode = 2
[node name="VBox" type="VBoxContainer" parent="TabContainer/Log/VBoxContainer/TabContainer/Config"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="DConsole" type="CheckButton" parent="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox"]
layout_mode = 2
size_flags_horizontal = 3
text = "Envoie les messages de debug vers la console"
alignment = 2
[node name="VConsole" type="CheckButton" parent="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox"]
layout_mode = 2
text = "Envoie les messages d'information vers la console"
alignment = 2
[node name="EConsole" type="CheckButton" parent="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox"]
layout_mode = 2
text = "Envoie les messages d'erreur vers la console"
alignment = 2
[node name="HSeparator" type="HSeparator" parent="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox"]
layout_mode = 2
[node name="DApplication" type="CheckButton" parent="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox"]
layout_mode = 2
size_flags_horizontal = 3
text = "Envoie les messages de debug vers l'application"
alignment = 2
[node name="VApplication" type="CheckButton" parent="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox"]
layout_mode = 2
text = "Envoie les messages d'information vers l'application"
alignment = 2
[node name="EApplication" type="CheckButton" parent="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox"]
layout_mode = 2
text = "Envoie les messages d'erreur vers l'application"
alignment = 2
[connection signal="close_requested" from="." to="." method="_on_close_requested"] [connection signal="close_requested" from="." to="." method="_on_close_requested"]
[connection signal="gui_input" from="TabContainer/Log/VBoxContainer/TabContainer/Messages/ItemList" to="." method="_on_item_list_gui_input"]
[connection signal="toggled" from="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/DConsole" to="." method="_on_console_toggled"]
[connection signal="toggled" from="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/VConsole" to="." method="_on_v_console_toggled"]
[connection signal="toggled" from="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/EConsole" to="." method="_on_e_console_toggled"]
[connection signal="toggled" from="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/DApplication" to="." method="_on_application_toggled"]
[connection signal="toggled" from="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/VApplication" to="." method="_on_v_application_toggled"]
[connection signal="toggled" from="TabContainer/Log/VBoxContainer/TabContainer/Config/VBox/EApplication" to="." method="_on_e_application_toggled"]

View file

@ -83,19 +83,11 @@ func _on_connexion_updated(new_state:Multi.Connexion):
$Panel.show() $Panel.show()
func _on_update_me(pos:Vector3, rot:Vector3): func _on_update_me(tick:int, pos:Vector3, rot:Vector3):
self.set_player_position(pos) $PlayerSpawnLocation.get_child(0).set_first_position_player(tick, pos, rot)
self.set_player_rotation(rot)
#self.get_node("CharacterBody3D").set_enable_event(true)
#for idx in $PlayerSpawnLocation.get_child_count():
# $PlayerSpawnLocation.queue_free()
#var p = PlayerCharacter.instantiate()
#$PlayerSpawnLocation.add_child(p)
#$CameraStarting.set_current(false)
#self.set_player_position(pos)
func _on_update_player(id:int, pos:Vector3, rot:Vector3): func _on_update_player(id:int, tick:int, pos:Vector3, rot:Vector3, extra:int, tickjump:int, vel:Vector3):
var child = $Players.find_child(str(id), false, false) var child = $Players.find_child(str(id), false, false)
if child == null: if child == null:
print("Add player : ", id) print("Add player : ", id)
@ -105,16 +97,11 @@ func _on_update_player(id:int, pos:Vector3, rot:Vector3):
$Players.add_child(instance) $Players.add_child(instance)
instance.set_visible(true) instance.set_visible(true)
instance.set_id(id) instance.set_id(id)
var child2 = $Players.find_child(str(id), false, false) child = $Players.find_child(str(id), false, false)
child2.set_my_position(pos)
child2.set_my_rotation(rot)
else: else:
print("Update player : ", id, " ", pos, " ", rot) print("Update player : ", id, " ", pos, " ", rot, " ", extra, " ",tickjump, " ", vel)
#print(pos) child.update_player(tick, pos, rot, extra, tickjump, vel)
#pos.y += 10.0
child.set_my_position(pos)
child.set_my_rotation(rot)
#child.set_visible(true)
func _on_remove_player(id:int): func _on_remove_player(id:int):

View file

@ -1,6 +1,12 @@
extends Node extends Node
signal connexion_updated(new_state)
signal update_my_position(tick, pos, rot)
signal update_player_position(id, tick, pos, rot, extra, tickjump, velocity)
signal remove_player(id)
@export var listen_ip:String = "127.0.0.1": @export var listen_ip:String = "127.0.0.1":
set = set_ip set = set_ip
@ -53,12 +59,6 @@ enum Connexion{
id = value id = value
signal connexion_updated(new_state)
signal update_my_position(pos, rot)
signal update_player_position(id, pos, rot)
signal remove_player(id)
var enet:ENetConnection var enet:ENetConnection
var dataEnet:ENetPacketPeer var dataEnet:ENetPacketPeer
var errorEnet:Error var errorEnet:Error
@ -123,52 +123,70 @@ func bad_account():
func get_event_received(): func get_event_received():
var data = dataEnet.get_packet() var data:PackedFlowPull = PackedFlowPull.new(dataEnet)
var command = data.get_u8()
#var data = dataEnet.get_packet()
#print("get: ", data) #print("get: ", data)
if data[0] == 1: # Return connexion if command == 1: # Return connexion
if data[1] == 0: # OK var state = data.get_u8()
id = data.decode_u64(2) if state == 0: # OK
var x:float = data.decode_double(2+8) id = data.get_u64()
var y:float = data.decode_double(2+16) var x:float = data.get_f64()
var z:float = data.decode_double(2+24) var y:float = data.get_f64()
var rx:float = data.decode_double(2+32) var z:float = data.get_f64()
var ry:float = data.decode_double(2+40) var rx:float = data.get_f64()
var rz:float = data.decode_double(2+48) var ry:float = data.get_f64()
var _tick:int = data.decode_double(2+1) var rz:float = data.get_f64()
print("MyID:", id) var tick:int = data.get_u8()
#print("id:", id, " x:", x, " y:", y, " z:", z) #for i in range(56,74):
update_my_position.emit(Vector3(x, y, z), Vector3(rx, ry, rz)) # var tick1:int = data.decode_u8(2+i)
# print("tick ", i, " :", tick1)
Global.msg_info("ME - id:%d tick:%d x:%d y:%d z:%d", [id, tick, x, y, z])
update_my_position.emit(tick, Vector3(x, y, z), Vector3(rx, ry, rz))
#self.set_player_position(Vector3(x, y, z)) #self.set_player_position(Vector3(x, y, z))
update_state(Connexion.CONNECTED) update_state(Connexion.CONNECTED)
else: # KO else: # KO
bad_account() bad_account()
elif data[0] == 3: # Get position elif command == 3: # Get position
if id == 0: if id == 0:
return return
var nb:int = data[1] var nb:int = data.get_u8()
var pos:int = 2
for i in nb: for i in nb:
var mid:int = data.decode_u64(pos) var mid:int = data.get_u64()
var mx:float = data.decode_double(pos+8) var mx:float = data.get_f64()
var my:float = data.decode_double(pos+16) var my:float = data.get_f64()
var mz:float = data.decode_double(pos+24) var mz:float = data.get_f64()
var rx:float = data.decode_double(pos+32) var rx:float = data.get_f64()
var ry:float = data.decode_double(pos+40) var ry:float = data.get_f64()
var rz:float = data.decode_double(pos+48) var rz:float = data.get_f64()
var tick:int = data.decode_u8(pos+56) var tick:int = data.get_u8()
pos += 57 var extra:int = data.get_u8()
var vx:float
var vy:float
var vz:float
var tickjump:int
var jump:bool = (extra & 1) == 1
if jump:
tickjump = data.get_u8()
vx = data.get_f64()
vy = data.get_f64()
vz = data.get_f64()
#for ii in range(56,74):
# var tick1:int = data.decode_u8(pos+ii)
# print("tick ", ii, " :", tick1)
if mid == id: if mid == id:
#print("Me id:", mid, " x:", mx, " y:", my, " z:", mz) #print("Me id:", mid, " x:", mx, " y:", my, " z:", mz)
continue continue
print("pos:", pos, " id:", mid, " tick:", tick, " x:", mx, " y:", my, " z:", mz, " rx:", rx, " ry:", ry, " rz:", rz) Global.msg_info("OTHER - id:%d tick:%d mx:%d my:%d mz:%d rx:%d ry:%d rz:%d tickjump:%d vx:%d vy:%d vz:%d", [mid, tick, mx, my ,mz ,rx, ry ,rz, tickjump, vx, vy ,vz])
update_player_position.emit(mid, Vector3(mx, my, mz), Vector3(rx, ry, rz)) #print(" id:", mid, " tick:", tick, " x:", mx, " y:", my, " z:", mz, " rx:", rx, " ry:", ry, " rz:", rz, " tickjump:", tickjump, " vx:", vx, " vy:", vy, " vz:", vz)
var nbuserremove:int = data[pos] update_player_position.emit(mid, tick, Vector3(mx, my, mz), Vector3(rx, ry, rz), extra, tickjump, Vector3(vx, vy, vz))
pos += 1 var nbuserremove:int = data.get_u8()
for i in nbuserremove: for i in nbuserremove:
var mid = data.decode_u64(pos) var mid = data.get_u64()
pos += 8
if mid == id: if mid == id:
print("Try to remove me :", mid) Global.msg_info("Try to remove me : %d", [mid])
continue continue
remove_player.emit(mid) remove_player.emit(mid)
@ -181,7 +199,7 @@ func send_account():
var packed_array = username.to_ascii_buffer() var packed_array = username.to_ascii_buffer()
data += packed_array data += packed_array
print(username, " -> size:", data.size(), " / " , len(username) ) Global.msg_debug("%s -> size:%s / %d ", [ username, data.size(), len(username)] )
errorEnet = dataEnet.send(1, data, 1) errorEnet = dataEnet.send(1, data, 1)
if errorEnet != OK: if errorEnet != OK:
print("ERROR ENET: ", errorEnet) print("ERROR ENET: ", errorEnet)
@ -191,22 +209,23 @@ func send_account():
func get_player_position(): func get_player_position():
if state_connexion != Connexion.CONNECTED: if state_connexion != Connexion.CONNECTED:
return return
var pos:PackedFloat64Array = PackedFloat64Array() var data:PackedFlowPush = PackedFlowPush.new()
var posRaw:Vector3 = player_position.get_my_position() #get_position() var posRaw:Vector3 = player_position.get_my_position() #get_position()
pos.append(posRaw.x)
pos.append(posRaw.y)
pos.append(posRaw.z)
var rotRaw:Vector3 = player_position.get_my_rotation() var rotRaw:Vector3 = player_position.get_my_rotation()
pos.append(rotRaw.x) data.put_vector3(posRaw)
pos.append(rotRaw.y) data.put_vector3(rotRaw)
pos.append(rotRaw.z) if player_position.is_jump():
var data:PackedByteArray = PackedByteArray() Global.msg_debug("Jump Jump", [])
data += pos.to_byte_array() data.put_u8(1)
errorEnet = dataEnet.send(2, data, 1) data.put_u8(player_position.get_tickjump())
data.put_vector3(player_position.get_jump())
else:
data.put_u8(0)
errorEnet = data.push(dataEnet, 2, 1)
if errorEnet == ERR_UNCONFIGURED: if errorEnet == ERR_UNCONFIGURED:
update_state(Connexion.NONE) update_state(Connexion.NONE)
elif errorEnet != OK: elif errorEnet != OK:
print("ERROR ENET: ", errorEnet) Global.msg_error("ERROR ENET: %s", [str(errorEnet)])
return return

View file

@ -0,0 +1,31 @@
class_name PackedFlowPull
var data:PackedByteArray = PackedByteArray()
var offset:int = 0
func _init(dataSrc:ENetPacketPeer) -> void:
if dataSrc != null:
self.data = dataSrc.get_packet()
else:
self.data.clear()
self.offset = 0
func get_u8() -> int:
var ret:int
#print(self.data.size(), " - " , self.offset)
ret = self.data[self.offset]
self.offset += 1
return ret
func get_u64() -> int:
var ret:int
ret = data.decode_u64(self.offset)
self.offset += 8
return ret
func get_f64() -> float:
var ret:float
ret = data.decode_double(self.offset)
self.offset += 8
return ret

View file

@ -0,0 +1,35 @@
class_name PackedFlowPush
var data:PackedByteArray = PackedByteArray()
func _init() -> void:
self.data.clear()
func put_u8(value:int) -> void:
data.append(value)
func put_u64(value:int) -> void:
var pos:PackedInt64Array = PackedInt64Array()
pos.append(value)
data += pos.to_byte_array()
func puf_f64(value:float) -> void:
var pos:PackedFloat64Array = PackedFloat64Array()
pos.append(value)
data += pos.to_byte_array()
func put_vector3(value:Vector3) -> void:
var pos:PackedFloat64Array = PackedFloat64Array()
pos.append(value.x)
pos.append(value.y)
pos.append(value.z)
data += pos.to_byte_array()
func push(dataEnet:ENetPacketPeer, channel:int, flags:int) -> Error:
return dataEnet.send(channel, data, flags)

View file

@ -113,6 +113,44 @@ struct Position {
z: f64, z: f64,
} }
*/ */
/*
* User
*/
struct PacketFlowPull {
offset: usize,
}
impl PacketFlowPull {
pub fn new() -> PacketFlowPull {
Self {
offset: 0,
}
}
pub fn get_u8(&mut self, packet: &enet::Packet) -> u8 {
let next:usize = self.offset + 1;
let mut data: &[u8] = &packet.data()[self.offset..next];
let value:u8 = data.read_u8().unwrap();
self.offset = next;
value
}
pub fn get_u64(&mut self, packet: &enet::Packet) -> u64 {
let next:usize = self.offset + 8;
let mut data: &[u8] = &packet.data()[self.offset..next];
let value:u64 = data.read_u64::<LittleEndian>().unwrap();
self.offset = next;
value
}
pub fn get_f64(&mut self, packet: &enet::Packet) -> f64 {
let next:usize = self.offset + 8;
let mut data: &[u8] = &packet.data()[self.offset..next];
let value:f64 = data.read_f64::<LittleEndian>().unwrap();
self.offset = next;
value
}
}
/* /*
* User * User
*/ */
@ -127,10 +165,16 @@ struct User {
rx: f64, // rotation X rx: f64, // rotation X
ry: f64, // rotation Y ry: f64, // rotation Y
rz: f64, // rotation Z rz: f64, // rotation Z
vx: f64, // velocity X
vy: f64, // velocity Y
vz: f64, // velocity Z
position_updated: bool, position_updated: bool,
lasttime: Instant, lasttime: Instant,
sendfull: u8, sendfull: u8,
lastupdate: u8, lastupdate: u8,
jump: bool,
sendjump:u8,
tickjump:u8,
} }
impl PartialEq for User { impl PartialEq for User {
@ -156,10 +200,16 @@ impl User {
self.rx = 0.0; self.rx = 0.0;
self.ry = 0.0; self.ry = 0.0;
self.rz = 0.0; self.rz = 0.0;
self.vx = 0.0;
self.vy = 0.0;
self.vz = 0.0;
self.position_updated = false; self.position_updated = false;
self.lasttime = Instant::now(); self.lasttime = Instant::now();
self.sendfull = 0; self.sendfull = 0;
self.lastupdate = 0; self.lastupdate = 1;
self.jump = false;
self.tickjump = 0;
self.sendjump = 0;
} }
pub fn set_inactive(&mut self) { pub fn set_inactive(&mut self) {
self.active = false; self.active = false;
@ -218,13 +268,34 @@ impl User {
self.lastupdate = lastupdate; self.lastupdate = lastupdate;
} }
} }
pub fn update_jump(&mut self, vx:f64, vy:f64, vz:f64, tickjump:u8, lastupdate:u8) {
trace!("update_jump");
self.vx = vx;
self.vy = vy;
self.vz = vz;
self.jump = true;
self.lastupdate = lastupdate;
self.tickjump = tickjump;
self.sendjump = 3;
}
pub fn update_no_jump(&mut self, lastupdate:u8) {
if self.jump == true && self.sendjump == 0 {
trace!("update_no_jump");
self.vx = 0.0;
self.vy = 0.0;
self.vz = 0.0;
self.jump = false;
self.lastupdate = lastupdate;
self.sendjump = 0;
}
}
/* /*
pub fn get_position(&mut self) -> Position { pub fn get_position(&mut self) -> Position {
let pos:Position = Position{x: self.x, y: self.y, z: self.z}; let pos:Position = Position{x: self.x, y: self.y, z: self.z};
return pos; return pos;
} }
*/ */
pub fn push_packet_get_position(&self, data:&mut Vec<u8>) { pub fn push_packet_player(&mut self, data:&mut Vec<u8>) {
push_u64(data, self.id); push_u64(data, self.id);
push_f64(data, self.x); push_f64(data, self.x);
push_f64(data, self.y); push_f64(data, self.y);
@ -233,6 +304,19 @@ impl User {
push_f64(data, self.ry); push_f64(data, self.ry);
push_f64(data, self.rz); push_f64(data, self.rz);
push_u8(data, self.lastupdate); push_u8(data, self.lastupdate);
if self.sendjump > 0 && self.jump == true {
trace!("Send Jump");
push_u8(data, 1);
push_u8(data,self.tickjump);
push_f64(data, self.vx);
push_f64(data, self.vy);
push_f64(data, self.vz);
self.sendjump -= 1;
} else {
push_u8(data, 0);
self.sendjump = 0;
}
} }
pub fn push_packet_id(&self, data:&mut Vec<u8>) { pub fn push_packet_id(&self, data:&mut Vec<u8>) {
push_u64(data, self.id); push_u64(data, self.id);
@ -361,9 +445,23 @@ impl Users {
pub fn add(&mut self, username:String, address: Address) -> u64 { pub fn add(&mut self, username:String, address: Address) -> u64 {
let id = self.get_new_id(); let id = self.get_new_id();
self.player_active += 1; self.player_active += 1;
self.users.push( User { active: true, username:username, address: address, id: id, x: 0.0, y: 10.0, z:0.0, rx: 0.0, ry: 0.0, rz:0.0, position_updated:true, lasttime: Instant::now(), sendfull:10, lastupdate:0} ); self.users.push( User { active: true,
username:username,
address: address,
id: id,
x: 0.0, y: 10.0, z:0.0,
rx: 0.0, ry: 0.0, rz:0.0,
vx: 0.0, vy: 0.0, vz:0.0,
position_updated:true,
jump: false,
lasttime: Instant::now(),
sendfull:10,
lastupdate:1,
sendjump: 0,
tickjump:0} );
id id
} }
/*
pub fn update_pos_rot(&mut self, address: Address, x:f64, y:f64, z:f64, rx:f64, ry:f64, rz:f64, tick:u8) { pub fn update_pos_rot(&mut self, address: Address, x:f64, y:f64, z:f64, rx:f64, ry:f64, rz:f64, tick:u8) {
for user in self.users.iter_mut() { for user in self.users.iter_mut() {
if user.address == address { if user.address == address {
@ -371,6 +469,7 @@ impl Users {
} }
} }
} }
*/
pub fn set_inactive(&mut self, address: Address) -> u64 { pub fn set_inactive(&mut self, address: Address) -> u64 {
for user in self.users.iter_mut() { for user in self.users.iter_mut() {
if user.address == address { if user.address == address {
@ -446,11 +545,20 @@ impl Users {
error!("invalid address {}:{}", address.ip(), address.port()); error!("invalid address {}:{}", address.ip(), address.port());
Err("invalid address") Err("invalid address")
} }
pub fn push_packet_get_position(&self, data:&mut Vec<u8>, getall: bool) -> u8 { pub fn get_user_rw(&mut self, address: Address) -> Result<&mut User, &'static str> {
for user in &mut self.users {
if user.address == address {
return Ok(user);
}
}
error!("invalid address {}:{}", address.ip(), address.port());
Err("invalid address")
}
pub fn push_packet_player(&mut self, data:&mut Vec<u8>, getall: bool) -> u8 {
let mut nb:u8 = 0; let mut nb:u8 = 0;
for user in &self.users { for user in &mut self.users {
if user.active && (getall || user.position_updated ) { if user.active && (getall || user.position_updated ) {
user.push_packet_get_position(data); user.push_packet_player(data);
nb += 1; nb += 1;
} }
} }
@ -549,11 +657,11 @@ fn send_message(sender:Peer<()>, data: &[u8] ) -> Result<(), Error> {
) )
} }
fn send_message_connect_ok(sender:Peer<()>, user: &User) -> Result<(), Error> { fn send_message_connect_ok(sender:Peer<()>, user: &mut User) -> Result<(), Error> {
let mut data:Vec<u8> = Vec::new(); let mut data:Vec<u8> = Vec::new();
data.push(1); // return connexion request data.push(1); // return connexion request
data.push(0); // return ok data.push(0); // return ok
user.push_packet_get_position(&mut data); user.push_packet_player(&mut data);
let c: &[u8] = &data; let c: &[u8] = &data;
send_message(sender, c) send_message(sender, c)
} }
@ -743,7 +851,7 @@ fn main() -> anyhow::Result<()> {
let mut launch_cleanup : u8 = 60; let mut launch_cleanup : u8 = 60;
let mut last_update:Instant = Instant::now(); let mut last_update:Instant = Instant::now();
let mut stat:Statistics = Statistics::new(); let mut stat:Statistics = Statistics::new();
let mut tick : u8 = 0; let mut tick : u8 = 1;
if cli.trace { if cli.trace {
loginit(LevelFilter::Trace).unwrap(); loginit(LevelFilter::Trace).unwrap();
@ -775,7 +883,7 @@ fn main() -> anyhow::Result<()> {
info!("Started"); info!("Started");
loop { loop {
trace!("users: {}", users); trace!("users: {}", users);
if tick == 255 { if tick < 255 {
tick += 1; tick += 1;
} else { } else {
tick = 1; tick = 1;
@ -834,8 +942,8 @@ fn main() -> anyhow::Result<()> {
StateUsers::NotDefined => { StateUsers::NotDefined => {
debug!("NotDefined"); debug!("NotDefined");
force_update = cli.forceupdate; force_update = cli.forceupdate;
let _id = users.add(s.to_string(), sender.address()); let _id: u64 = users.add(s.to_string(), sender.address());
let ret = users.get_user(sender.address()); let ret: Result<&mut User, &str> = users.get_user_rw(sender.address());
match ret { match ret {
Ok(user) => { Ok(user) => {
info!("Add player : {} (id:{})", user.username, user.id); info!("Add player : {} (id:{})", user.username, user.id);
@ -851,8 +959,8 @@ fn main() -> anyhow::Result<()> {
StateUsers::Inactive => { StateUsers::Inactive => {
debug!("Inactive"); debug!("Inactive");
force_update = cli.forceupdate; force_update = cli.forceupdate;
let _id = users.set_active(sender.address()); let _id: u64 = users.set_active(sender.address());
let ret = users.get_user(sender.address()); let ret: Result<&mut User, &str> = users.get_user_rw(sender.address());
match ret { match ret {
Ok(user) => { Ok(user) => {
info!("Inactive player : {} (id:{})", user.username, user.id); info!("Inactive player : {} (id:{})", user.username, user.id);
@ -868,8 +976,8 @@ fn main() -> anyhow::Result<()> {
StateUsers::UpdateUser => { StateUsers::UpdateUser => {
debug!("UpdateUser"); debug!("UpdateUser");
force_update = cli.forceupdate; force_update = cli.forceupdate;
let _id = users.update_username(s.to_string(), sender.address()); let _id: u64 = users.update_username(s.to_string(), sender.address());
let ret = users.get_user(sender.address()); let ret: Result<&mut User, &str> = users.get_user_rw(sender.address());
match ret { match ret {
Ok(user) => { Ok(user) => {
info!("Add player : {} (id:{})", user.username, user.id); info!("Add player : {} (id:{})", user.username, user.id);
@ -885,8 +993,8 @@ fn main() -> anyhow::Result<()> {
StateUsers::UpdateAddress => { StateUsers::UpdateAddress => {
debug!("UpdateAddress"); debug!("UpdateAddress");
force_update = cli.forceupdate; force_update = cli.forceupdate;
let _id = users.update_address(s.to_string(), sender.address()); let _id: u64 = users.update_address(s.to_string(), sender.address());
let ret = users.get_user(sender.address()); let ret: Result<&mut User, &str> = users.get_user_rw(sender.address());
match ret { match ret {
Ok(user) => { Ok(user) => {
info!("Add player : {} (id:{})", user.username, user.id); info!("Add player : {} (id:{})", user.username, user.id);
@ -907,8 +1015,8 @@ fn main() -> anyhow::Result<()> {
StateUsers::Done => { StateUsers::Done => {
debug!("Done"); debug!("Done");
force_update = cli.forceupdate; force_update = cli.forceupdate;
let _id = users.get_id(sender.address()); let _id: u64 = users.get_id(sender.address());
let ret = users.get_user(sender.address()); let ret: Result<&mut User, &str> = users.get_user_rw(sender.address());
match ret { match ret {
Ok(user) => { Ok(user) => {
stat.inc_recv_done(); stat.inc_recv_done();
@ -923,6 +1031,53 @@ fn main() -> anyhow::Result<()> {
} }
} }
2 => { 2 => {
/*
let mut xbytes: &[u8] = &packet.data()[0..8];
let x = xbytes.read_f64::<LittleEndian>().unwrap();
let mut ybytes: &[u8] = &packet.data()[8..16];
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()[24..32];
let rx = rxbytes.read_f64::<LittleEndian>().unwrap();
let mut rybytes: &[u8] = &packet.data()[32..40];
let ry = rybytes.read_f64::<LittleEndian>().unwrap();
let mut rzbytes: &[u8] = &packet.data()[40..48];
let rz = rzbytes.read_f64::<LittleEndian>().unwrap();
*/
let mut reader:PacketFlowPull = PacketFlowPull::new();
let x = reader.get_f64(packet);
let y = reader.get_f64(packet);
let z = reader.get_f64(packet);
let rx = reader.get_f64(packet);
let ry = reader.get_f64(packet);
let rz = reader.get_f64(packet);
// let mut jumpbytes: &[u8] = &packet.data()[49..49];
// let jump = jumpbytes.read_u8().unwrap();
let ret = users.get_user_rw(sender.address());
match ret {
Ok(user) => {
user.update_pos_rot(x, y, z, rx, ry, rz, tick);
let extra: u8 = reader.get_u8(packet);
let jump: bool = (extra & 1) == 1;
if jump == true {
trace!("Received Jump");
let tickjump = reader.get_u8(packet);
let vx = reader.get_f64(packet);
let vy = reader.get_f64(packet);
let vz = reader.get_f64(packet);
user.update_jump(vx, vy, vz, tickjump, tick);
} else {
user.update_no_jump(tick);
}
},
Err(_e) => {
send_message_connect_ko(sender.clone()).unwrap();
stat.inc_recv_invaliduser();
},
};
/*
let mut xbytes: &[u8] = &packet.data()[0..8]; let mut xbytes: &[u8] = &packet.data()[0..8];
let x = xbytes.read_f64::<LittleEndian>().unwrap(); let x = xbytes.read_f64::<LittleEndian>().unwrap();
let mut ybytes: &[u8] = &packet.data()[8..16]; let mut ybytes: &[u8] = &packet.data()[8..16];
@ -936,6 +1091,7 @@ fn main() -> anyhow::Result<()> {
let mut rzbytes: &[u8] = &packet.data()[40..48]; let mut rzbytes: &[u8] = &packet.data()[40..48];
let rz = rzbytes.read_f64::<LittleEndian>().unwrap(); let rz = rzbytes.read_f64::<LittleEndian>().unwrap();
users.update_pos_rot(sender.address(), x, y, z, rx, ry, rz, tick); users.update_pos_rot(sender.address(), x, y, z, rx, ry, rz, tick);
*/
} }
_ => { _ => {
send_message_connect_ko(sender.clone()).unwrap(); send_message_connect_ko(sender.clone()).unwrap();
@ -961,7 +1117,7 @@ fn main() -> anyhow::Result<()> {
let mut data3:Vec<u8> = Vec::new(); let mut data3:Vec<u8> = Vec::new();
data.push(3); // return connexion request data.push(3); // return connexion request
// get list user position // get list user position
let nb:u8 = users.push_packet_get_position(&mut data2, force_update > 0); let nb:u8 = users.push_packet_player(&mut data2, force_update > 0);
if force_update > 0 { if force_update > 0 {
force_update -= 1; force_update -= 1;
} }