Skip to content
Snippets Groups Projects
Commit 0956d825 authored by Blaise CONRARD's avatar Blaise CONRARD
Browse files

Ajout version 1 du code

parent a1ba92f4
Branches
No related tags found
No related merge requests found
Showing
with 2763 additions and 0 deletions
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 1234
print ("UDP target IP:", UDP_IP)
print ("UDP target port:", UDP_PORT)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM)
while (True):
msg = input("Msg to send (empty=quit):")
if msg=="": break
sock.sendto(bytes(msg,"ascii"), (UDP_IP, UDP_PORT))
print ("Msg sent")
print ("Wait for a reply")
data, addr = sock.recvfrom(1024)
print ("valeur reçue:", data)
socket.close(socket.fileno())
extends VehicleBody
var parent:Node = null
var dir:float = 0
func set_parent(obj:Node):
parent = obj
#var posCamera:Vector3
#var orientCamera:Vector3
func _ready():
#posCamera = $ViewportContainer/Viewport/CameraImg.get_transform().origin
#orientCamera = $ViewportContainer/Viewport/CameraImg.rotation
#print ("Orientation:",orientCamera)
pass # Replace with function body.
func getComm_speed() -> String:
var vit:float = linear_velocity.length()
return String(vit)
func getComm_position() -> String:
return (String(get_global_transform().origin.x) + ","
+ String(get_global_transform().origin.z) + ","
+ String(get_global_transform().basis.get_euler()[1]))
func getComm_camera() -> String:
#var vit:float = linear_velocity.length()
parent.array_reponse = getImage().save_png_to_buffer()
return "$ARRAY"
func setComm_steering(value):
dir = value
steering = value
func setComm_engine(value):
engine_force = value
getComm_speed()
func processSelectedObj(delta):
var force:float = 0.0
if Input.is_key_pressed(KEY_Z): force = 200.0
if Input.is_key_pressed(KEY_S): force = -200.0
engine_force = force
dir = 0.0
if Input.is_key_pressed(KEY_D): dir = -1.0
if Input.is_key_pressed(KEY_Q): dir = 1.0
if Input.is_key_pressed(KEY_SPACE): # inutile
dir = 0.0
engine_force = 0
if steering > dir :
steering = steering - delta
if steering < dir :
steering = steering + delta
func get_description() -> String:
return name + ":" + "AGV20f"
func _process(delta):
test_placeCamera()
pass
func _on_UglyCar_input_event(camera, event, click_position, click_normal, shape_idx):
if parent != null and event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print ("car Selected")
parent.set_selectedObj(self)
func getImage():
#$ViewportContainer/Viewport/CameraImg.global_transform=global_transform
#$ViewportContainer/Viewport/CameraImg.translate_object_local(posCamera)
#$ViewportContainer/Viewport/CameraImg.rotate_y(-90)
var img = $Viewport.get_texture().get_data()
#var img = $ViewportContainer/Viewport.get_texture().get_data()
#printt ("Height=",img.get_height(),",width=",img.get_width(),"Format=",img.get_format())
#img.flip_y()
return img
func test_lectPositionCamera():
#return $Camera.global_transform.origin
return $ViewportContainer/Viewport/CameraImg.global_transform.origin
func test_affCamera():
$ViewportContainer.visible = true
func test_placeCamera():
#$ViewportContainer/Viewport/CameraImg.global_transform=$Camera.global_transform
$Viewport/CameraImg.global_transform=$Camera.global_transform
#$ViewportContainer/Viewport/Camera.translate_object_local(posCamera)
#$ViewportContainer/Viewport/Camera.rotate_y(-90)
extends RigidBody
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func get_description() -> String:
return name + ":Container"
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func processSelectedObj(delta):
pass
func capturePossible():
return true
func _on_ContainerDry40__input_event(camera, event, click_position, click_normal, shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
owner.set_selectedObj(self)
extends RigidBody
var setHAimant:float = 0.0
# consigne de hauteur
var pickedObj:Node = null
# Called when the node enters the scene tree for the first time.
func _ready():
setHAimant = $StaticBodyAimant.transform.origin.y
pass # Replace with function body.
func get_description() -> String:
return name + ":Crane"
func processSelectedObj(delta):
if Input.is_key_pressed(KEY_Z):
add_central_force(get_transform().basis.xform(Vector3(10.0, 0.0, 0.0)))
if Input.is_key_pressed(KEY_S):
add_central_force(get_transform().basis.xform(Vector3(-10.0, 0.0, 0.0)))
if Input.is_key_pressed(KEY_R): setHAimant += delta * 2.0
if Input.is_key_pressed(KEY_F): setHAimant -= delta * 2.0
if Input.is_key_pressed(KEY_W) and pickedObj==null:
var lObj = $StaticBodyAimant/AreaPrise.get_overlapping_bodies()
if lObj.size() > 0:
#pickObject(lObj[0])
call_deferred("pickObject",lObj[0])
if Input.is_key_pressed(KEY_X) and pickedObj!=null:
#unpickObject()
call_deferred("unpickObject")
func manage_aimant(delta):
if abs(setHAimant-$StaticBodyAimant.transform.origin.y)>0.05:
var depl:float = setHAimant - $StaticBodyAimant.transform.origin.y
# depl = min(delta,max(-delta,depl))
$StaticBodyAimant.translate_object_local(Vector3(0.0,depl,0.0))
func manage_pickedObj(delta):
if pickedObj != null:
pass
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
manage_aimant(delta)
manage_pickedObj(delta)
func pickObject(obj:Node):
pickedObj = obj
print ("(Gantry) pickObject de ",get_path_to(obj),",",typeof(obj))
var pos = obj.global_transform
owner.remove_child(obj)
obj.set_mode(1) # static
obj.set_use_custom_integrator(true) # pas de memorisation des forces
#$CollisionShape2.add_child_below_node(obj,$CollisionShape2/MeshInstance2)
#$CollisionShape2.add_child(obj)
$StaticBodyAimant.add_child(obj)
obj.set_global_transform(pos)
pass
func unpickObject():
print ("(Gantry) unpickObject de ",get_path_to(pickedObj),",",typeof(pickedObj))
var pos = pickedObj.global_transform
#$CollisionShape2.remove_child(pickedObj)
$StaticBodyAimant.remove_child(pickedObj)
#remove_child(pickedObj)
pickedObj.set_global_transform(pos)
pickedObj.set_use_custom_integrator(false)
#for e in pickedObj.get_children():
# if e is CollisionShape:
# e.disabled = false
pickedObj.set_mode(0) # MODE_RIGID
owner.add_child(pickedObj)
pickedObj.add_central_force(Vector3(0.0,0.0,0))
pickedObj = null
pass
func _on_GantryAGV_input_event(camera, event, click_position, click_normal, shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
owner.set_selectedObj(self)
func _on_Area_body_entered(body):
print ("(Gantry) Arrive de ",get_path_to(body),",",typeof(body))
func _on_Area_body_exited(body):
print ("(Gantry) Depart de ",body.get_path())
print ("(Gantry) Depart de ",get_path_to(body))
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Code/AGV.gd" type="Script" id=1]
[sub_resource type="BoxShape" id=2]
extents = Vector3( 3, 0.5, 1.25 )
[sub_resource type="CubeMesh" id=3]
size = Vector3( 6, 0.5, 2.5 )
[sub_resource type="CylinderMesh" id=4]
top_radius = 0.5
bottom_radius = 0.5
height = 0.5
rings = 1
[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0.196078, 0.196078, 0.196078, 1 )
[node name="AGV" type="VehicleBody"]
script = ExtResource( 1 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0 )
shape = SubResource( 2 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, 0 )
mesh = SubResource( 3 )
material/0 = null
[node name="VehicleWheel" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 2.7, 0.5, 1.05 )
use_as_traction = true
use_as_steering = true
wheel_rest_length = 0.1
[node name="MeshInstance" type="MeshInstance" parent="VehicleWheel"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel2" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 2.7, 0.5, -1.05 )
use_as_traction = true
use_as_steering = true
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel2"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel3" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -2.7, 0.5, -1.05 )
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel3"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel4" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -2.7, 0.5, 1.05 )
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel4"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_clear_mode = 2
render_target_update_mode = 3
[node name="CameraImg" type="Camera" parent="Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 3.19744e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
[node name="ViewportContainer" type="ViewportContainer" parent="."]
visible = false
margin_left = 651.379
margin_top = 359.077
margin_right = 971.379
margin_bottom = 559.077
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_update_mode = 0
[node name="CameraImg" type="Camera" parent="ViewportContainer/Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 2.84217e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
fov = 179.0
[node name="Camera" type="Camera" parent="."]
transform = Transform( -1.354e-07, 0.55615, -0.831082, 9.06084e-08, 0.831082, 0.55615, 1, -1.63425e-13, -1.6292e-07, -4.98023, 4.07872, 0 )
[node name="HelpDialog" type="WindowDialog" parent="."]
visible = true
margin_right = 273.0
margin_bottom = 176.0
[node name="RichTextLabel" type="RichTextLabel" parent="HelpDialog"]
margin_left = 8.0
margin_top = 10.0
margin_right = 262.0
margin_bottom = 163.0
text = "A simple car
- use Z,S,Q,D to move it
- use C to display its camera
"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="input_event" from="." to="." method="_on_UglyCar_input_event"]
[gd_scene load_steps=6 format=2]
[sub_resource type="GDScript" id=1]
script/source = "extends VehicleBody
var parent:Node = null
var dir:float = 0
func set_parent(obj:Node):
parent = obj
#var posCamera:Vector3
#var orientCamera:Vector3
func _ready():
#posCamera = $ViewportContainer/Viewport/CameraImg.get_transform().origin
#orientCamera = $ViewportContainer/Viewport/CameraImg.rotation
#print (\"Orientation:\",orientCamera)
pass # Replace with function body.
func getComm_speed() -> String:
var vit:float = linear_velocity.length()
return String(vit)
func getComm_position() -> String:
return (String(get_global_transform().origin.x) + \",\"
+ String(get_global_transform().origin.z) + \",\"
+ String(get_global_transform().basis.get_euler()[1]))
func getComm_camera() -> String:
#var vit:float = linear_velocity.length()
parent.array_reponse = getImage().save_png_to_buffer()
return \"$ARRAY\"
func setComm_steering(value):
dir = value
steering = value
func setComm_engine(value):
engine_force = value
getComm_speed()
func processSelectedObj(delta):
var force:float = 0.0
if Input.is_key_pressed(KEY_Z): force = 100.0
if Input.is_key_pressed(KEY_S): force = -100.0
engine_force = force
dir = 0.0
if Input.is_key_pressed(KEY_D): dir = -1.0
if Input.is_key_pressed(KEY_Q): dir = 1.0
if Input.is_key_pressed(KEY_SPACE): # inutile
dir = 0.0
engine_force = 0
if steering > dir :
steering = steering - delta
if steering < dir :
steering = steering + delta
func get_description() -> String:
return name + \":\" + \"UglyCar\"
func _process(delta):
test_placeCamera()
pass
func _on_UglyCar_input_event(camera, event, click_position, click_normal, shape_idx):
if parent != null and event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print (\"car Selected\")
parent.set_selectedObj(self)
func getImage():
#$ViewportContainer/Viewport/CameraImg.global_transform=global_transform
#$ViewportContainer/Viewport/CameraImg.translate_object_local(posCamera)
#$ViewportContainer/Viewport/CameraImg.rotate_y(-90)
var img = $Viewport.get_texture().get_data()
#var img = $ViewportContainer/Viewport.get_texture().get_data()
#printt (\"Height=\",img.get_height(),\",width=\",img.get_width(),\"Format=\",img.get_format())
#img.flip_y()
return img
func test_lectPositionCamera():
#return $Camera.global_transform.origin
return $ViewportContainer/Viewport/CameraImg.global_transform.origin
func test_affCamera():
$ViewportContainer.visible = true
func test_placeCamera():
#$ViewportContainer/Viewport/CameraImg.global_transform=$Camera.global_transform
$Viewport/CameraImg.global_transform=$Camera.global_transform
#$ViewportContainer/Viewport/Camera.translate_object_local(posCamera)
#$ViewportContainer/Viewport/Camera.rotate_y(-90)
"
[sub_resource type="BoxShape" id=2]
extents = Vector3( 6, 0.5, 1.25 )
[sub_resource type="CubeMesh" id=3]
size = Vector3( 12, 0.5, 2.5 )
[sub_resource type="CylinderMesh" id=4]
top_radius = 0.5
bottom_radius = 0.5
height = 0.5
radial_segments = 32
rings = 1
[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0.196078, 0.196078, 0.196078, 1 )
[node name="AGV" type="VehicleBody"]
script = SubResource( 1 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0 )
shape = SubResource( 2 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, 0 )
mesh = SubResource( 3 )
material/0 = null
[node name="VehicleWheel" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 5.2, 0.5, 1.05 )
use_as_traction = true
use_as_steering = true
wheel_rest_length = 0.1
[node name="MeshInstance" type="MeshInstance" parent="VehicleWheel"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel2" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 5.2, 0.5, -1.05 )
use_as_traction = true
use_as_steering = true
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel2"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel3" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -5.2, 0.5, -1.05 )
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel3"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel4" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -5.2, 0.5, 1.05 )
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel4"]
transform = Transform( -1.62921e-07, 1, -4.37114e-08, 0, -4.37114e-08, -1, -1, -1.62921e-07, 7.12149e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_clear_mode = 2
render_target_update_mode = 3
[node name="CameraImg" type="Camera" parent="Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 2.84217e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
visible = false
[node name="ViewportContainer" type="ViewportContainer" parent="."]
visible = false
margin_left = 651.379
margin_top = 359.077
margin_right = 971.379
margin_bottom = 559.077
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_update_mode = 0
[node name="CameraImg" type="Camera" parent="ViewportContainer/Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 2.84217e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( -1.46362e-07, 0.439249, -0.898365, 7.15628e-08, 0.898365, 0.439249, 1, -1.56319e-13, -1.6292e-07, -8.16195, 3.39547, 0 )
[node name="HelpDialog" type="WindowDialog" parent="."]
visible = true
margin_right = 273.0
margin_bottom = 176.0
[node name="RichTextLabel" type="RichTextLabel" parent="HelpDialog"]
margin_left = 8.0
margin_top = 10.0
margin_right = 262.0
margin_bottom = 163.0
text = "A simple car
- use Z,S,Q,D to move it
- use C to display its camera
"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="input_event" from="." to="." method="_on_UglyCar_input_event"]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Code/ContainerDry40.gd" type="Script" id=1]
[ext_resource path="res://img/Container_Texture/CorrugatedSteel002_material.tres" type="Material" id=2]
[sub_resource type="PhysicsMaterial" id=4]
rough = true
[sub_resource type="CubeMesh" id=1]
size = Vector3( 1, 1, 1 )
[sub_resource type="BoxShape" id=2]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=3]
extents = Vector3( 0.5, 0.5, 0.5 )
[node name="ContainerDry40_" type="RigidBody"]
collision_layer = 3
collision_mask = 2
physics_material_override = SubResource( 4 )
contacts_reported = 1
contact_monitor = true
script = ExtResource( 1 )
[node name="MeshInstanceCube" type="MeshInstance" parent="."]
transform = Transform( 12.2, 0, 0, 0, 2.6, 0, 0, 0, 2.5, 0, 1.3, 0 )
mesh = SubResource( 1 )
material/0 = ExtResource( 2 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 12.2, 0, 0, 0, 2.6, 0, 0, 0, 2.5, 0, 1.3, 0 )
shape = SubResource( 2 )
[node name="Area" type="Area" parent="."]
gravity_vec = Vector3( 0, 0, 0 )
[node name="CollisionShape" type="CollisionShape" parent="Area"]
transform = Transform( 12.2, 0, 0, 0, 2.61, 0, 0, 0, 2.5, 0, 1.3, 0 )
shape = SubResource( 3 )
[connection signal="input_event" from="." to="." method="_on_ContainerDry40__input_event"]
[connection signal="body_entered" from="Area" to="." method="_on_Area_body_entered"]
[connection signal="body_exited" from="Area" to="." method="_on_Area_body_exited"]
[gd_scene load_steps=22 format=2]
[ext_resource path="res://Equipement/WheelsCrane.tscn" type="PackedScene" id=1]
[ext_resource path="res://Code/GantryAGV.gd" type="Script" id=2]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="CubeMesh" id=2]
size = Vector3( 1, 1, 1 )
[sub_resource type="SpatialMaterial" id=3]
albedo_color = Color( 0.713726, 0.188235, 0.188235, 1 )
[sub_resource type="BoxShape" id=4]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=5]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=6]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=7]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=8]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=9]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="CubeMesh" id=10]
size = Vector3( 1, 1, 1 )
[sub_resource type="SpatialMaterial" id=11]
albedo_color = Color( 0.686275, 0.635294, 0.635294, 1 )
[sub_resource type="BoxShape" id=12]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="CylinderMesh" id=13]
top_radius = 0.5
bottom_radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=14]
radius = 0.5
height = 1.0
[sub_resource type="CubeMesh" id=15]
size = Vector3( 1, 1, 1 )
[sub_resource type="BoxShape" id=16]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=17]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=18]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=19]
extents = Vector3( 0.5, 0.5, 0.5 )
[node name="GantryAGV" type="RigidBody"]
can_sleep = false
script = ExtResource( 2 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, -6.5, 0.75, 7.5 )
shape = SubResource( 1 )
__meta__ = {
"_editor_description_": ""
}
[node name="WheelsCrane" parent="CollisionShape" instance=ExtResource( 1 )]
transform = Transform( 0.166667, 0, 0, 0, 0.666667, 0, 0, 0, 0.666667, 0, -0.5, 0 )
[node name="CollisionShape2" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, -6.5, 0.75, -7.5 )
shape = SubResource( 1 )
__meta__ = {
"_editor_description_": ""
}
[node name="WheelsCrane" parent="CollisionShape2" instance=ExtResource( 1 )]
transform = Transform( 0.166667, 0, 0, 0, 0.666667, 0, 0, 0, 0.666667, 0, -0.5, 0 )
[node name="CollisionShape3" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 6.5, 0.75, 7.5 )
shape = SubResource( 1 )
__meta__ = {
"_editor_description_": ""
}
[node name="WheelsCrane" parent="CollisionShape3" instance=ExtResource( 1 )]
transform = Transform( 0.166667, 0, 0, 0, 0.666667, 0, 0, 0, 0.666667, 0, -0.5, 0 )
[node name="CollisionShape4" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 6.5, 0.75, -7.5 )
shape = SubResource( 1 )
__meta__ = {
"_editor_description_": ""
}
[node name="WheelsCrane" parent="CollisionShape4" instance=ExtResource( 1 )]
transform = Transform( 0.166667, 0, 0, 0, 0.666667, 0, 0, 0, 0.666667, 0, -0.5, 0 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 15, 0, 0, 0, 0.5, 0, 0, 0, 1, 0, 1.75, 7.5 )
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="CollisionShape5" type="CollisionShape" parent="."]
transform = Transform( 15, 0, 0, 0, 0.5, 0, 0, 0, 1, 0, 1.75, 7.5 )
shape = SubResource( 4 )
[node name="MeshInstance2" type="MeshInstance" parent="."]
transform = Transform( 15, 0, 0, 0, 0.5, 0, 0, 0, 1, 0, 1.75, -7.5 )
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="CollisionShape6" type="CollisionShape" parent="."]
transform = Transform( 15, 0, 0, 0, 0.5, 0, 0, 0, 1, 0, 1.75, -7.5 )
shape = SubResource( 5 )
[node name="MeshInstance3" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, -7, 9.5, 7.5 )
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="CollisionShape7" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, -7, 9.5, 7.5 )
shape = SubResource( 6 )
[node name="MeshInstance4" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, 7, 9.5, 7.5 )
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="CollisionShape8" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, 7, 9.5, 7.5 )
shape = SubResource( 7 )
[node name="MeshInstance5" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, 7, 9.5, -7.5 )
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="CollisionShape9" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, 7, 9.5, -7.5 )
shape = SubResource( 8 )
[node name="MeshInstance6" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, -7, 9.5, -7.5 )
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="CollisionShape10" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 15, 0, 0, 0, 1, -7, 9.5, -7.5 )
shape = SubResource( 9 )
[node name="MeshInstanceBras" type="MeshInstance" parent="."]
transform = Transform( 15, 0, 0, 0, 1, 0, 0, 0, 16, 0, 17.5, 0 )
mesh = SubResource( 10 )
material/0 = SubResource( 11 )
[node name="CollisionShapeBras" type="CollisionShape" parent="."]
transform = Transform( 15, 0, 0, 0, 1, 0, 0, 0, 16, 0, 17.5, 0 )
shape = SubResource( 12 )
[node name="StaticBodyCable" type="Area" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 17, 0 )
[node name="MeshInstanceCable" type="MeshInstance" parent="StaticBodyCable"]
transform = Transform( 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, -1.5, 0 )
mesh = SubResource( 13 )
material/0 = null
[node name="CollisionShapeCable" type="CollisionShape" parent="StaticBodyCable"]
transform = Transform( 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, -1.5, 0 )
shape = SubResource( 14 )
[node name="StaticBodyAimant" type="StaticBody" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.69167, 0 )
[node name="MeshInstanceAimant" type="MeshInstance" parent="StaticBodyAimant"]
transform = Transform( 12.2, 0, 0, 0, 0.5, 0, 0, 0, 2.5, 0, 0, 0 )
mesh = SubResource( 15 )
material/0 = null
[node name="CollisionShapeAimant" type="CollisionShape" parent="StaticBodyAimant"]
transform = Transform( 12.2, 0, 0, 0, 0.5, 0, 0, 0, 2.5, 0, 0, 0 )
shape = SubResource( 16 )
[node name="AreaPrise" type="Area" parent="StaticBodyAimant"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.833802, 0 )
[node name="CollisionShape" type="CollisionShape" parent="StaticBodyAimant/AreaPrise"]
transform = Transform( 6, 0, 0, 0, 1, 0, 0, 0, 0.25, 0, 0, 0 )
shape = SubResource( 17 )
[node name="AreaTouche" type="Area" parent="StaticBodyAimant"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.01, 0 )
visible = false
[node name="CollisionShape" type="CollisionShape" parent="StaticBodyAimant/AreaTouche"]
transform = Transform( 12.2, 0, 0, 0, 0.25, 0, 0, 0, 2.5, 0, -0.125, 0 )
shape = SubResource( 18 )
[node name="AreaSousConteneurTouche" type="Area" parent="StaticBodyAimant"]
transform = Transform( 12.2, 0, 0, 0, 0.1, 0, 0, 0, 2.5, 0, -3, 0 )
visible = false
[node name="CollisionShape" type="CollisionShape" parent="StaticBodyAimant/AreaSousConteneurTouche"]
shape = SubResource( 19 )
[connection signal="input_event" from="." to="." method="_on_GantryAGV_input_event"]
[connection signal="body_entered" from="StaticBodyAimant/AreaPrise" to="." method="_on_Area_body_entered"]
[connection signal="body_exited" from="StaticBodyAimant/AreaPrise" to="." method="_on_Area_body_exited"]
[connection signal="body_entered" from="StaticBodyAimant/AreaTouche" to="." method="_on_AreaTouche_body_entered"]
[connection signal="body_exited" from="StaticBodyAimant/AreaTouche" to="." method="_on_AreaTouche_body_exited"]
[connection signal="body_entered" from="StaticBodyAimant/AreaSousConteneurTouche" to="." method="_on_AreaSousConteneurTouche_body_entered"]
[connection signal="body_exited" from="StaticBodyAimant/AreaSousConteneurTouche" to="." method="_on_AreaSousConteneurTouche_body_exited"]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://img/Boat_Texture/Metal030_1_material.tres" type="Material" id=1]
[ext_resource path="res://img/Boat_Texture/Metal030_2_material.tres" type="Material" id=2]
[ext_resource path="res://img/Boat_Texture/Facade005_material.tres" type="Material" id=3]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="SpatialMaterial" id=2]
albedo_color = Color( 0.878431, 0.137255, 0.137255, 1 )
[sub_resource type="SpatialMaterial" id=3]
albedo_color = Color( 0.490196, 0.247059, 0.247059, 1 )
[sub_resource type="BoxShape" id=4]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="CylinderMesh" id=5]
top_radius = 0.5
bottom_radius = 0.5
height = 1.0
[node name="PanamaxBoat" type="StaticBody"]
__meta__ = {
"_editor_description_": "Longueur = 180 + 20 m
Largeur = 32 m
Tirant d'eau = 8 m
Tirant d'air = 6 m + 19 m (tour de contrôle)
Pour info : 6 m + 4*H_conteneur"
}
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 200, 0, 0, 0, 14, 0, 0, 0, 32, 10, -1, 0 )
shape = SubResource( 1 )
[node name="CSGCombiner2" type="CSGCombiner" parent="CollisionShape"]
transform = Transform( 0.005, 0, 0, 0, 0.0714286, 0, 0, 0, 0.03125, -0.05, 0.0714286, 0 )
material_override = ExtResource( 1 )
[node name="CSGCombiner2" type="CSGCombiner" parent="CollisionShape/CSGCombiner2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4, 0 )
material_override = SubResource( 2 )
operation = 2
[node name="CSGBox" type="CSGBox" parent="CollisionShape/CSGCombiner2/CSGCombiner2"]
transform = Transform( 180, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0 )
operation = 2
width = 1.0
height = 1.0
depth = 1.0
[node name="CSGCylinder" type="CSGCylinder" parent="CollisionShape/CSGCombiner2/CSGCombiner2"]
transform = Transform( 1.30337e-06, -181, -2.60673e-06, -8, -2.94886e-05, 0, -4.2469e-13, 5.89773e-05, -8, 0, -4, 16 )
operation = 2
sides = 4
smooth_faces = false
[node name="CSGCylinder2" type="CSGCylinder" parent="CollisionShape/CSGCombiner2/CSGCombiner2"]
transform = Transform( 1.30337e-06, -181, -2.60673e-06, -8, -2.94886e-05, 0, -4.2469e-13, 5.89773e-05, -8, 0, -4, -16 )
operation = 2
sides = 4
smooth_faces = false
[node name="CSGPolygon2" type="CSGPolygon" parent="CollisionShape/CSGCombiner2"]
transform = Transform( -6.42143e-06, 0, -20, 0, 8, 0, 16, 0, -8.02679e-06, 90, -8, 0 )
polygon = PoolVector2Array( 0, 1, 0, 1, 1, 1, 0.5, 0, 0, 0 )
mode = 1
spin_degrees = 180.0
spin_sides = 32
[node name="CSGBox2" type="CSGBox" parent="CollisionShape/CSGCombiner2"]
transform = Transform( 180, 0, 0, 0, 6, 0, 0, 0, 32, 0, 3, 0 )
material_override = SubResource( 3 )
width = 1.0
height = 1.0
depth = 1.0
[node name="CSGPolygon3" type="CSGPolygon" parent="CollisionShape/CSGCombiner2"]
transform = Transform( -6.42143e-06, 0, -20, 0, 8, 0, 16, 0, -8.02679e-06, 90, -2, 0 )
polygon = PoolVector2Array( 0, 1, 0, 1, 1, 1, 1, 0.25, 0, 0 )
mode = 1
spin_degrees = 180.0
spin_sides = 32
[node name="CollisionShape2" type="CollisionShape" parent="."]
transform = Transform( 15, 0, 0, 0, 19, 0, 0, 0, 26, -81, 15.5, 0 )
shape = SubResource( 4 )
[node name="CSGCombiner" type="CSGCombiner" parent="CollisionShape2"]
transform = Transform( 0.0666667, 0, 0, 0, 0.0526316, 0, 0, 0, 0.0384615, 0, -0.5, 0 )
material_override = ExtResource( 2 )
[node name="CSGBox" type="CSGBox" parent="CollisionShape2/CSGCombiner"]
transform = Transform( 15, 0, 0, 0, 10, 0, 0, 0, 26, 0, 5, 0 )
width = 1.0
height = 1.0
depth = 1.0
[node name="CSGCylinder" type="CSGCylinder" parent="CollisionShape2/CSGCombiner"]
transform = Transform( -4.37114e-07, -30, 0, 10, -1.31134e-06, 0, 0, 0, 30, 0, 10, 0 )
radius = 0.5
height = 0.5
sides = 6
smooth_faces = false
[node name="CSGCylinder2" type="CSGCylinder" parent="CollisionShape2/CSGCombiner"]
transform = Transform( 15, 0, 0, 0, 14, 0, 0, 0, 26, 0, 15.5, 0 )
radius = 0.5
height = 0.5
sides = 64
smooth_faces = false
[node name="CSGCylinder3" type="MeshInstance" parent="CollisionShape2"]
transform = Transform( 1, 0, 0, 0, 0.132, 0, 0, 0, 1, 0.00999832, 0.368263, 0 )
material_override = ExtResource( 3 )
mesh = SubResource( 5 )
material/0 = null
[gd_scene load_steps=40 format=2]
[ext_resource path="res://Equipement/WheelsCrane.tscn" type="PackedScene" id=3]
[ext_resource path="res://img/PanamaxCrane_Texture/PanamaxCrane_cable_material.tres" type="Material" id=5]
[ext_resource path="res://img/PanamaxCrane_Texture/PanamaxCrane_Metal010_material.tres" type="Material" id=6]
[ext_resource path="res://img/PanamaxCrane_Texture/PanamaxCrane_Metal011_material.tres" type="Material" id=7]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 0.5, 0.5, 0.42096 )
[sub_resource type="CubeMesh" id=2]
size = Vector3( 1, 1, 1 )
[sub_resource type="BoxShape" id=3]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=4]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=5]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=6]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=7]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=8]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=9]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=10]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=11]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=12]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=13]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=14]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="CubeMesh" id=15]
size = Vector3( 1, 1, 1 )
[sub_resource type="BoxShape" id=16]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=17]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="CapsuleMesh" id=18]
radius = 0.323
[sub_resource type="CapsuleShape" id=19]
radius = 0.2
[sub_resource type="CylinderMesh" id=20]
top_radius = 0.5
bottom_radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=21]
radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=22]
radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=23]
radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=24]
radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=25]
radius = 0.5
height = 1.0
[sub_resource type="CylinderMesh" id=26]
top_radius = 0.5
bottom_radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=27]
radius = 0.5
height = 1.0
[sub_resource type="CylinderMesh" id=28]
top_radius = 0.5
bottom_radius = 0.5
height = 1.0
[sub_resource type="CylinderShape" id=29]
radius = 0.5
height = 1.0
[sub_resource type="CubeMesh" id=30]
size = Vector3( 1, 1, 1 )
[sub_resource type="SpatialMaterial" id=31]
albedo_color = Color( 1, 0.705882, 0.0784314, 1 )
[sub_resource type="BoxShape" id=32]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=33]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=34]
extents = Vector3( 0.5, 0.5, 0.5 )
[sub_resource type="BoxShape" id=35]
extents = Vector3( 0.5, 0.5, 0.5 )
[node name="PanamaxCrane" type="RigidBody"]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
collision_mask = 2147483649
[node name="CollisionShapeWheelsCrane1" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 8.5, 0.75, -15 )
shape = SubResource( 1 )
[node name="WheelsCrane" parent="CollisionShapeWheelsCrane1" instance=ExtResource( 3 )]
transform = Transform( 0.166667, 0, 0, 0, 0.666667, 0, 0, 0, 0.666667, 0, -0.5, 0 )
[node name="CollisionShapeWheelsCrane2" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, -8.5, 0.75, -15 )
shape = SubResource( 1 )
[node name="WheelsCrane" parent="CollisionShapeWheelsCrane2" instance=ExtResource( 3 )]
transform = Transform( 0.166667, 0, 0, 0, 0.666667, 0, 0, 0, 0.666667, 0, -0.5, 0 )
[node name="CollisionShapeWheelsCrane3" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, -8.5, 0.75, 15 )
shape = SubResource( 1 )
[node name="WheelsCrane" parent="CollisionShapeWheelsCrane3" instance=ExtResource( 3 )]
transform = Transform( 0.166667, 0, 1.06581e-14, 0, 0.666667, 0, -4.26326e-14, 0, 0.666667, 0, -0.5, 0 )
[node name="CollisionShapeWheelsCrane4" type="CollisionShape" parent="."]
transform = Transform( 6, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 8, 0.75, 15 )
shape = SubResource( 1 )
[node name="WheelsCrane" parent="CollisionShapeWheelsCrane4" instance=ExtResource( 3 )]
transform = Transform( 0.166667, 0, 0, 0, 0.666667, 0, 0, 0, 0.666667, 0, -0.5, 0 )
[node name="MeshInstance1" type="MeshInstance" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape1" type="CollisionShape" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 15 )
shape = SubResource( 3 )
[node name="MeshInstance2" type="MeshInstance" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, -15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape2" type="CollisionShape" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, -15 )
shape = SubResource( 4 )
[node name="MeshInstance3" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, -8.5, 23.75, 15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape3" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, -8.5, 23.75, 15 )
shape = SubResource( 5 )
[node name="MeshInstance4" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, 8.5, 23.75, 15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape4" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, 8.5, 23.75, 15 )
shape = SubResource( 6 )
[node name="MeshInstance5" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, -8.5, 23.75, -15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape5" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, -8.5, 23.75, -15 )
shape = SubResource( 7 )
[node name="MeshInstance6" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, 8.5, 23.75, -15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape6" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 42.5, 0, 0, 0, 1, 8.5, 23.75, -15 )
shape = SubResource( 8 )
[node name="MeshInstance7" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, -8.5, 15.5, 0 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape7" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, -8.5, 15.5, 0 )
shape = SubResource( 9 )
[node name="MeshInstance8" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, 8.5, 15.5, 0 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape8" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, 8.5, 15.5, 0 )
shape = SubResource( 10 )
[node name="MeshInstance9" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, -8.5, 45.5, 0 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape9" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, -8.5, 45.5, 0 )
shape = SubResource( 11 )
[node name="MeshInstance10" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, 8.5, 45.5, 0 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape10" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 31, 8.5, 45.5, 0 )
shape = SubResource( 12 )
[node name="MeshInstance11" type="MeshInstance" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 45.5, 15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape11" type="CollisionShape" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 45.5, 15 )
shape = SubResource( 13 )
[node name="MeshInstance12" type="MeshInstance" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 45.5, -15 )
mesh = SubResource( 2 )
material/0 = ExtResource( 6 )
[node name="CollisionShape12" type="CollisionShape" parent="."]
transform = Transform( 18, 0, 0, 0, 1, 0, 0, 0, 1, 0, 45.5, -15 )
shape = SubResource( 14 )
[node name="MeshInstance13" type="MeshInstance" parent="."]
transform = Transform( 2, 0, 0, 0, 0.5, 0, 0, 0, 98, 0, 44.75, -15.5 )
mesh = SubResource( 15 )
material/0 = ExtResource( 7 )
[node name="CollisionShape13" type="CollisionShape" parent="."]
transform = Transform( 2, 0, 0, 0, 0.5, 0, 0, 0, 98, 0, 44.75, -15.5 )
shape = SubResource( 16 )
[node name="Bras" type="MeshInstance" parent="."]
transform = Transform( 4, 0, 0, 0, 0.5, 0, 0, 0, 100, 0, 42.75, -15.5 )
mesh = SubResource( 15 )
material/0 = ExtResource( 7 )
[node name="CollisionShapeBras" type="CollisionShape" parent="."]
transform = Transform( 4, 0, 0, 0, 0.5, 0, 0, 0, 100, 0, 42.75, -15.5 )
shape = SubResource( 17 )
[node name="MeshInstance15" type="MeshInstance" parent="."]
transform = Transform( 0.549822, -0.74254, 0.688554, 0.183228, 0.554029, 1.46175, -0.814937, -0.376412, 0.793208, -1.25, 43.75, -64.75 )
mesh = SubResource( 18 )
material/0 = ExtResource( 7 )
[node name="CollisionShape15" type="CollisionShape" parent="."]
transform = Transform( 0.549822, -0.74254, 0.688554, 0.183227, 0.554029, 1.46175, -0.814937, -0.376412, 0.793208, -1.25, 43.75, -64.75 )
shape = SubResource( 19 )
[node name="MeshInstance16" type="MeshInstance" parent="."]
transform = Transform( 0.116231, -0.851073, -0.921636, 0.567774, -0.366045, 1.32718, -0.814937, -0.376412, 0.793208, 1.25, 43.75, -64.75 )
mesh = SubResource( 18 )
material/0 = ExtResource( 7 )
[node name="CollisionShape16" type="CollisionShape" parent="."]
transform = Transform( 0.116231, -0.851073, -0.921636, 0.567774, -0.366044, 1.32718, -0.814937, -0.376412, 0.793208, 1.25, 43.75, -64.75 )
shape = SubResource( 19 )
[node name="MeshInstance17" type="MeshInstance" parent="."]
transform = Transform( -0.549822, 0.74254, -0.688554, 0.183227, 0.554029, 1.46175, 0.814937, 0.376412, -0.793208, 1.25, 43.75, 33.75 )
mesh = SubResource( 18 )
material/0 = ExtResource( 7 )
[node name="CollisionShape17" type="CollisionShape" parent="."]
transform = Transform( -0.549822, 0.74254, -0.688554, 0.183227, 0.554029, 1.46175, 0.814937, 0.376412, -0.793208, 1.25, 43.75, 33.75 )
shape = SubResource( 19 )
[node name="MeshInstance18" type="MeshInstance" parent="."]
transform = Transform( -0.116232, 0.851073, 0.921636, 0.567774, -0.366045, 1.32718, 0.814938, 0.376412, -0.793208, -1.25, 43.75, 33.75 )
mesh = SubResource( 18 )
material/0 = ExtResource( 7 )
[node name="CollisionShape18" type="CollisionShape" parent="."]
transform = Transform( -0.116231, 0.851073, 0.921636, 0.567774, -0.366044, 1.32718, 0.814937, 0.376412, -0.793208, -1.25, 43.75, 33.75 )
shape = SubResource( 19 )
[node name="MeshInstance19" type="MeshInstance" parent="."]
transform = Transform( 0.866025, -7.5, 0, 0.5, 12.9904, 0, 0, 0, 1, 4.5, 52, -15 )
mesh = SubResource( 20 )
material/0 = ExtResource( 7 )
[node name="CollisionShape19" type="CollisionShape" parent="."]
transform = Transform( 0.866025, -7.5, 0, 0.5, 12.9904, 0, 0, 0, 1, 4.5, 52, -15 )
shape = SubResource( 21 )
[node name="MeshInstance20" type="MeshInstance" parent="."]
transform = Transform( -0.866025, 7.5, -8.74228e-08, 0.5, 12.9904, 0, 7.57103e-08, -6.55671e-07, -1, -4.5, 52, -15 )
mesh = SubResource( 20 )
material/0 = ExtResource( 7 )
[node name="CollisionShape20" type="CollisionShape" parent="."]
transform = Transform( -0.866025, 7.5, -8.74228e-08, 0.5, 12.9904, 0, 7.57103e-08, -6.55671e-07, -1, -4.5, 52, -15 )
shape = SubResource( 22 )
[node name="MeshInstance21" type="MeshInstance" parent="."]
transform = Transform( 0.956741, -8.19421, 0.15162, -0.0430516, 13.0209, 0.917856, -0.287737, -29.1944, 0.366813, 4, 52, 0.5 )
mesh = SubResource( 20 )
material/0 = ExtResource( 7 )
[node name="CollisionShape21" type="CollisionShape" parent="."]
transform = Transform( 0.956741, -8.19421, 0.15162, -0.0430516, 13.0209, 0.917856, -0.287737, -29.1944, 0.366813, 4, 52, 0.5 )
shape = SubResource( 23 )
[node name="MeshInstance22" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 12.941, -0.965926, 0, 48.2963, 0.258819, 3.8147e-06, 51, -39 )
mesh = SubResource( 20 )
material/0 = ExtResource( 7 )
[node name="CollisionShape22" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 12.941, -0.965926, 0, 48.2963, 0.258819, 3.8147e-06, 51, -39 )
shape = SubResource( 24 )
[node name="MeshInstance23" type="MeshInstance" parent="."]
transform = Transform( 0.365318, 8.3379, 0.895937, -0.885296, 12.9293, 0.250488, -0.287737, -29.1944, 0.366813, -4, 52, 0.5 )
mesh = SubResource( 20 )
material/0 = ExtResource( 7 )
[node name="CollisionShape23" type="CollisionShape" parent="."]
transform = Transform( 0.365318, 8.3379, 0.895937, -0.885296, 12.9293, 0.250488, -0.287737, -29.1944, 0.366813, -4, 52, 0.5 )
shape = SubResource( 25 )
[node name="MeshInstance24" type="MeshInstance" parent="."]
transform = Transform( 4, 0, 0, 0, 2, 0, 0, 0, 4, 0, 58.5, -14.5 )
mesh = SubResource( 26 )
material/0 = ExtResource( 7 )
[node name="CollisionShape24" type="CollisionShape" parent="."]
transform = Transform( 4, 0, 0, 0, 2, 0, 0, 0, 4, 0, 58.5, -14.5 )
shape = SubResource( 27 )
[node name="Cable" type="Area" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 42.5, 0 )
[node name="Cable" type="MeshInstance" parent="Cable"]
transform = Transform( 1, 0, 0, 0, 10, 0, 0, 0, 1, -2.98023e-08, -5, 0 )
mesh = SubResource( 28 )
material/0 = ExtResource( 5 )
[node name="CollisionShape" type="CollisionShape" parent="Cable"]
transform = Transform( 1, 0, 0, 0, 10, 0, 0, 0, 1, -2.98023e-08, -5, 0 )
shape = SubResource( 29 )
[node name="Aimant" type="StaticBody" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 32.5, 0 )
[node name="Aimant" type="MeshInstance" parent="Aimant"]
transform = Transform( 12.2, 0, 0, 0, 0.5, 0, 0, 0, 2.5, 0, 0, 0 )
mesh = SubResource( 30 )
material/0 = SubResource( 31 )
[node name="CollisionShape" type="CollisionShape" parent="Aimant"]
transform = Transform( 12.2, 0, 0, 0, 0.5, 0, 0, 0, 2.5, 0, 0, 0 )
shape = SubResource( 32 )
[node name="AreaPrise" type="Area" parent="Aimant"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, 0 )
[node name="CollisionShape" type="CollisionShape" parent="Aimant/AreaPrise"]
transform = Transform( 6, 0, 0, 0, 1, 0, 0, 0, 0.25, 0, 0, 0 )
shape = SubResource( 33 )
[node name="AreaTouche" type="Area" parent="Aimant"]
transform = Transform( 12.2, 0, 0, 0, 0.25, 0, 0, 0, 2.5, 0, -0.13, 0 )
[node name="CollisionShape" type="CollisionShape" parent="Aimant/AreaTouche"]
shape = SubResource( 34 )
[node name="AreaSousConteneurTouche" type="Area" parent="Aimant"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3, 0 )
[node name="CollisionShape" type="CollisionShape" parent="Aimant/AreaSousConteneurTouche"]
transform = Transform( 12.2, 0, 0, 0, 0.1, 0, 0, 0, 2.5, 0, 0, 0 )
shape = SubResource( 35 )
[connection signal="body_entered" from="Aimant/AreaPrise" to="." method="_on_AreaPrise_body_entered"]
[connection signal="body_exited" from="Aimant/AreaPrise" to="." method="_on_AreaPrise_body_exited"]
[connection signal="body_entered" from="Aimant/AreaTouche" to="." method="_on_AreaTouche_body_entered"]
[connection signal="body_exited" from="Aimant/AreaTouche" to="." method="_on_AreaTouche_body_exited"]
[connection signal="body_entered" from="Aimant/AreaSousConteneurTouche" to="." method="_on_AreaSousConteneurTouche_body_entered"]
[connection signal="body_exited" from="Aimant/AreaSousConteneurTouche" to="." method="_on_AreaSousConteneurTouche_body_exited"]
[gd_scene load_steps=6 format=2]
[sub_resource type="CubeMesh" id=1]
size = Vector3( 1, 1, 1 )
[sub_resource type="SpatialMaterial" id=2]
albedo_color = Color( 1, 0, 0, 1 )
[sub_resource type="CylinderMesh" id=3]
[sub_resource type="SpatialMaterial" id=4]
albedo_color = Color( 0, 0, 0, 1 )
[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0, 0, 0, 1 )
[node name="WheelsCrane" type="MeshInstance"]
[node name="Top" type="MeshInstance" parent="."]
transform = Transform( 3.5, 0, 0, 0, 0.5, 0, 0, 0, 1, 0, 1.25, 0 )
mesh = SubResource( 1 )
material/0 = SubResource( 2 )
[node name="Bottom" type="MeshInstance" parent="."]
transform = Transform( 5.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.75, 0 )
mesh = SubResource( 1 )
material/0 = SubResource( 2 )
[node name="Wheel1" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, -2.5, 0.5, 0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[node name="Wheel2" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, -1, 0.5, 0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[node name="Wheel3" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, 1, 0.5, 0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 5 )
[node name="Wheel4" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, 2.5, 0.5, 0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[node name="Wheel5" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, -2.5, 0.5, -0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[node name="Wheel6" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, -1, 0.5, -0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[node name="Wheel7" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, 1, 0.5, -0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[node name="Wheel8" type="MeshInstance" parent="."]
transform = Transform( 0.5, 0, 0, 0, -1.09278e-08, -0.5, 0, 0.25, -2.18557e-08, 2.5, 0.5, -0.5 )
mesh = SubResource( 3 )
material/0 = SubResource( 4 )
[gd_scene load_steps=20 format=2]
[ext_resource path="res://Test_or_Old/UglyStacker.tscn" type="PackedScene" id=1]
[ext_resource path="res://Test_or_Old/SimpleBox.tscn" type="PackedScene" id=2]
[ext_resource path="res://Test_or_Old/UglyCar.tscn" type="PackedScene" id=3]
[ext_resource path="res://Test_or_Old/spatialPoint.tscn" type="PackedScene" id=4]
[ext_resource path="res://Equipement/ContainerDry40.tscn" type="PackedScene" id=5]
[ext_resource path="res://Equipement/GantryAGV.tscn" type="PackedScene" id=6]
[ext_resource path="res://Equipement/PanamaxCrane.tscn" type="PackedScene" id=7]
[ext_resource path="res://Equipement/PanamaxBoat.tscn" type="PackedScene" id=8]
[ext_resource path="res://img/WorldEnvironment.tres" type="Environment" id=9]
[ext_resource path="res://Equipement/AGV20f.tscn" type="PackedScene" id=10]
[ext_resource path="res://Equipement/AGV40f.tscn" type="PackedScene" id=11]
[sub_resource type="GDScript" id=1]
script/source = "extends Spatial
var socketUDPIn: PacketPeerUDP = PacketPeerUDP.new()
var PORT_SERVER: int = 1234
var selectedObj:Node = null
var selectedCamera:Node = null
var array_reponse = null
var cpt: int = 0
var imageNoCamera = preload(\"res://NoCamera.png\")
# ****************************************
# Test capture d'image
# **************************************
var affImageActif:bool = false
var affImageDelay:float = 0.0
func _process_affImage(delta):
if not(affImageActif): return
affImageDelay = affImageDelay + delta
if affImageDelay>0.05:
affImageDelay = 0.0
var img = $uglyCar.getImage()
var tex = ImageTexture.new()
tex.create_from_image(img)
$Sprite.texture=tex
# *****************************************
func start_server():
# initialise le seveur UDP
if (socketUDPIn.listen(PORT_SERVER) != OK):
print(\"Error listening on port: \", str(PORT_SERVER))
else:
print(\"Serveur started on port: \",str(PORT_SERVER))
func emet_Msg(msg:String):
var ipClient = socketUDPIn.get_packet_ip()
var portClient = socketUDPIn.get_packet_port()
socketUDPIn.set_dest_address(ipClient, portClient)
if msg==\"$ARRAY\":
socketUDPIn.put_var( array_reponse )
return
socketUDPIn.put_packet( msg.to_ascii() )
func addElement(description: String):
var param = description.split(\",\")
var nom:String = param[0]
var type:String = param[1]
var defaultVal = { \"x\":0.0, \"y\":0.0, \"z\":0.0,
\"dx\":0.0, \"dy\":0.0, \"dz\":0.0 }
for i in range(2,param.size()):
if param[i].count(\":\") == 1:
var elem = param[i].split(':')
defaultVal[elem[0]] = elem[1].to_float()
# TODO : permettre, si besoin des non float
var obj = load(\"res://\"+type+\".tscn\")
# TODO !!! : contrôle de l'existance de l'objet
var newObj = obj.instance()
newObj.name = nom
newObj.translation = Vector3( defaultVal[\"x\"],
defaultVal[\"y\"], defaultVal[\"z\"])
newObj.rotation_degrees = Vector3( defaultVal[\"dx\"],
defaultVal[\"dy\"], defaultVal[\"dz\"])
newObj.set_parent(self)
add_child(newObj)
func getComm_list() -> String:
# retourne la liste des objets dans le simulateur
# sous la forme \"nom1:type,nom2:type...\"
var liste:String = \"\"
for elem in get_children():
if elem.has_method(\"get_description\"):
if liste.empty():
liste = elem.get_description()
else :
liste = liste +',' + elem.get_description()
return liste
func getComm_selectedObj() -> String:
if selectedObj != null:
return selectedObj.get_description()
return \"Void\"
func execute_cmd(cmd : String) -> String:
if cmd.ends_with('?'):
if not('.' in cmd):
var meth : String = \"getComm_\" + cmd.left(cmd.length()-1)
if has_method(meth):
return String(call(meth))
return \"Error : cmd unkonwn\"
var part = cmd.split(\".\",true,1)
var n = get_node(part[0])
if n == null: return \"Error : node unknown\"
var meth = \"getComm_\"+part[1].left(part[1].length()-1)
if n.has_method(meth):
var result = n.call(meth)
return result
return \"Error : field unknown\"
if not('=' in cmd): return \"Error: Syntaxe error\"
var part = cmd.split(\"=\", true, 1)
if not('.' in part[0]) : return \"Error: no '.'\"
var part2 = part[0].rsplit(\".\",true,1)
var noeud = part2[0]
var meth = \"setComm_\"+part2[1]
var valeurTxt = part[1] # .to_float()
var expression = Expression.new()
expression.parse(valeurTxt)
var valeur = expression.execute()
var n = get_node(noeud)
if n == null: return \"Error : node unknown\"
if n.has_method(meth):
var result = n.call(meth, valeur) # Dangereux sans test du type de valeur
#print (\"Call methode (\",meth,\",\",valeur,\")=\",
# result)
return \"OK\"
print (\"Pas de méthode\",meth,\"dans\",noeud)
return \"Error : field unknown\"
func _ready():
# démarrage
$Lab_description.set_text(\"Simulator (v. 2021/06/22)\")
start_server()
for n in get_children():
if n.has_method(\"set_parent\"):
n.set_parent(self)
#$uglyCar.set_parent(self)
#$CubeMobil.set_parent(self)
#$uglyCar2.set_parent(self)
func set_selectedObj(obj:Node):
# print (obj.name)
selectedObj = obj
$Camera.set_follow_this(obj)
if obj != null:
$Lab_description.set_text(obj.get_description())
else:
$Lab_description.set_text(\"Nothing is selected\")
func set_selectedCamera(obj:Node):
if obj==null: return
if not(obj.has_method(\"getImage\")):
selectedCamera = null
$ImageCamera.texture = imageNoCamera
return
selectedCamera = obj
$ImageCamera.visible = obj != null
func _process(delta):
_process_affImage(delta)
#print (Engine.get_frames_per_second())
if socketUDPIn.get_available_packet_count() > 0:
var msg : String = socketUDPIn.get_packet().get_string_from_ascii()
#print (\"Received msg:\", msg)
var result=execute_cmd(msg)
#print (\" ==> response:\", result)
emet_Msg(result)
if selectedObj != null: selectedObj.processSelectedObj(delta)
if selectedCamera != null : _affCamera()
if selectedObj != null and Input.is_key_pressed(KEY_C):
set_selectedCamera(selectedObj)
if Input.is_key_pressed(KEY_ESCAPE):
set_selectedObj(null)
set_selectedCamera(null)
func _exit_tree():
socketUDPIn.close()
print (\"Serveur closed\")
func _on_Bt_test_pressed():
#cpt = cpt + 1
#addElement(\"nom\"+str(cpt)+\",SimpleCube,y:2\")
#test_affImage()
if selectedObj!=null:
print (selectedObj.get_children())
if selectedObj.has_node(NodePath(\"HelpDialog\")):
var popup = selectedObj.get_node(NodePath(\"HelpDialog\"))
popup.set_title(selectedObj.get_description())
popup.popup_centered()
else:
$HelpDialog.popup_centered()
return
$Camera/HelpDialog.popup_centered()
#$PopupDialog.popup_centered()
#affImageActif = not(affImageActif)
#$GUI/WindowDialog.popup_centered()
#test_lectPosition()
#$uglyCar.test_affCamera()
pass # Replace with function body.
#var tex = ImageTexture.new()
#var img
func _affCamera():
# Uniquement pour du test de capture d'image de caméra
var img = selectedCamera.getImage()
var tex = ImageTexture.new()
tex.create_from_image(img)
$ImageCamera.texture=tex
func test_lectPosition():
print (\"Position :\",$uglyCar.get_translation())
print (\"Orientation :\",$uglyCar.get_rotation_degrees())
print (\"Position Caméra :\",$uglyCar.test_lectPositionCamera())
"
[sub_resource type="PlaneMesh" id=2]
[sub_resource type="SpatialMaterial" id=3]
albedo_color = Color( 0.678431, 0.823529, 0.921569, 1 )
[sub_resource type="CubeMesh" id=4]
[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0.627451, 0.619608, 0.619608, 1 )
[sub_resource type="BoxShape" id=6]
[sub_resource type="GDScript" id=7]
script/source = "extends Camera
export (NodePath) var follow_this_path = null
export var target_distance = 3.0
export var target_height = 2.0
var follow_this = null
var last_lookat
var _direction = Vector3(0.0, 0.0, 0.0)
var avantArriere : float = 0.0
func set_follow_this(obj:Node):
follow_this = obj
if obj != null:
last_lookat = follow_this.global_transform.origin
# Called when the node enters the scene tree for the first time.
func _ready():
# follow_this = get_node(follow_this_path)
# last_lookat = follow_this.global_transform.origin
last_lookat = null
func _input(event):
#if event is InputEventMouseMotion :
# var _mouse_offset = event.relative
# #print (_mouse_offset)
if event is InputEventMouseButton and event.pressed:
if event.button_index == BUTTON_WHEEL_UP :
avantArriere += 1.0
if event.button_index == BUTTON_WHEEL_DOWN:
avantArriere -= 1.0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_mouse_button_pressed(BUTTON_LEFT):
var depSouris = Input.get_last_mouse_speed()
rotate_object_local(Vector3(1.0,0.0,0.0),depSouris.y*delta*0.002)
rotate(Vector3(0.0,1.0,0.0),depSouris.x*delta*0.0025)
if avantArriere != 0.0 :
translate_object_local(Vector3(0.0, 0.0, 1.0) * avantArriere)
avantArriere = 0.0
if true: # follow_this == null or last_lookat == null:
# Monter/Descendre
var mvt : float = (Input.get_action_strength (\"ui_up\") -
Input.get_action_strength (\"ui_down\"))
if mvt != 0 :
translate(Vector3(0.0, 1.0, 0.0) * mvt * delta)
# Droite/Gauche
mvt = (Input.get_action_strength (\"ui_left\") -
Input.get_action_strength (\"ui_right\"))
if mvt != 0 :
translate_object_local(Vector3(1.0, 0.0, 0.0) * mvt * delta)
#_direction.x = Input.get_action_strength (\"ui_left\") - Input.get_action_strength (\"ui_right\")
#_direction.y = Input.get_action_strength (\"ui_page_up\") - Input.get_action_strength (\"ui_page_down\")
#_direction.z = Input.get_action_strength (\"ui_up\") - Input.get_action_strength (\"ui_down\")
#translate(_direction * delta)
return
var delta_v = global_transform.origin - follow_this.global_transform.origin
var target_pos = global_transform.origin
# ignore y
delta_v.y = 0.0
# if (delta_v.length() > target_distance):
# delta_v = delta_v.normalized() * target_distance
# delta_v.y = target_height
# target_pos = follow_this.global_transform.origin + delta_v
# else:
# target_pos.y = follow_this.global_transform.origin.y + target_height
global_transform.origin = global_transform.origin.linear_interpolate(target_pos, delta * 20.0)
last_lookat = last_lookat.linear_interpolate(follow_this.global_transform.origin, delta * 20.0)
look_at(last_lookat, Vector3(0.0, 1.0, 0.0))
"
[sub_resource type="GDScript" id=8]
script/source = "extends Label
# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"
var var_test:float = 0.0
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func set_valeur(val:float):
text = str(val)+\",\"+str(var_test)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
"
[node name="Spatial" type="Spatial"]
script = SubResource( 1 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1000, 0, 0, 0, 1, 0, 0, 0, 1000, 0, 0, 0 )
mesh = SubResource( 2 )
material/0 = SubResource( 3 )
[node name="StaticBody" type="StaticBody" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 0, 0 )
[node name="MeshInstance" type="MeshInstance" parent="StaticBody"]
transform = Transform( 100, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="CollisionShape" type="CollisionShape" parent="StaticBody"]
transform = Transform( 100, 0, 0, 0, 1, 0, 0, 0, 100, 0, 0, 0 )
shape = SubResource( 6 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.53545, 16.1168, 24.287 )
current = true
far = 250.0
script = SubResource( 7 )
[node name="HelpDialog" type="WindowDialog" parent="Camera"]
margin_left = 13.0
margin_top = 71.0
margin_right = 418.0
margin_bottom = 233.0
window_title = "Help"
resizable = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RichTextLabel" type="RichTextLabel" parent="Camera/HelpDialog"]
margin_left = 12.0
margin_top = 11.0
margin_right = 393.0
margin_bottom = 94.0
text = "- Use arrows to move camera
- Use mouse wheel to move forwards/backwards
- Select an object by clicking on it
- Unselect an object with [ESC]
"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Lab_description" type="Label" parent="."]
margin_left = 734.465
margin_top = 8.95935
margin_right = 1003.46
margin_bottom = 32.9594
text = "Vide"
script = SubResource( 8 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Bt_test" type="Button" parent="."]
margin_left = 22.6607
margin_top = 9.84706
margin_right = 61.6607
margin_bottom = 29.8471
focus_mode = 1
enabled_focus_mode = 1
text = "Help"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CubeMobil" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.17585, 5.31433, 5.10525 )
[node name="UglyCar0" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.43758, 1.85993, 2.63841 )
[node name="UglyCar4" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10.5232, 1.39138, 5.36235 )
[node name="UglyCar2" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.29883, 1.94261, 5.19316 )
[node name="ImageCamera" type="Sprite" parent="."]
position = Vector2( 810.128, 133.551 )
[node name="UglyCar5" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.68117, 1.93921, 2.99905 )
[node name="UglyCar3" parent="." instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.28292, 1.34589, 7.56357 )
[node name="UglySta0" parent="." instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.81395, 1.02856, 11.4363 )
[node name="CubeMobil2" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.64199, 2.37033, 11.4288 )
[node name="CubeMobil3" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.61443, 1.67841, 11.4382 )
[node name="HelpDialog" type="WindowDialog" parent="."]
margin_right = 287.0
margin_bottom = 55.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RichTextLabel" type="RichTextLabel" parent="HelpDialog"]
margin_left = 8.0
margin_top = 8.0
margin_right = 271.0
margin_bottom = 72.0
text = "Sorry, no help for this object.
Use [Esc] to unselect it."
[node name="Point1" parent="." instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 1.25, 15 )
[node name="Point2" parent="." instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 25, 1.25, -10 )
[node name="Point3" parent="." instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, -10 )
[node name="Point4" parent="." instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.25, 15 )
[node name="ContainerDry40_" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5.48972, 1.97304, -23.0723 )
[node name="ContainerDry40_2" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 22.0085, 1.97304, -23.0723 )
[node name="ContainerDry40_3" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 22.0085, 4.87271, -23.0723 )
[node name="GantryAGV" parent="." instance=ExtResource( 6 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -7.38187, 1.19212, -23.5318 )
[node name="GantryAGV2" parent="." instance=ExtResource( 6 )]
transform = Transform( 0.644711, 0, -0.764427, 0, 1, 0, 0.764427, 0, 0.644711, 52.3727, 0.983147, -49.2345 )
[node name="PanamaxCrane" parent="." instance=ExtResource( 7 )]
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, -52.733, 1.86612, 83.6421 )
[node name="PanamaxBoat" parent="." instance=ExtResource( 8 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 16.5199, 0.703903, 122.685 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource( 9 )
[node name="DirectionalLight" type="DirectionalLight" parent="WorldEnvironment"]
transform = Transform( 1, 0, 0, 0, 0.559714, 0.828686, 0, -0.828686, 0.559714, 0, 10, 0 )
shadow_enabled = true
[node name="AGV" parent="." instance=ExtResource( 10 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.43606, 1.64268, -9.95614 )
[node name="AGV2" parent="." instance=ExtResource( 11 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 22.1071, 1.0458, -15.9695 )
[node name="ContainerDry40_4" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -28.0888, 6.84701, 112.521 )
[connection signal="pressed" from="Bt_test" to="." method="_on_Bt_test_pressed"]
SimulSPEED/NoCamera.png

1.66 KiB

[remap]
importer="texture"
type="StreamTexture"
path="res://.import/NoCamera.png-62e6b81c523b901fa00e7a56f253817a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://NoCamera.png"
dest_files=[ "res://.import/NoCamera.png-62e6b81c523b901fa00e7a56f253817a.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
[gd_scene load_steps=4 format=2]
[sub_resource type="GDScript" id=1]
script/source = "extends RigidBody
var parent:Node = null
func set_parent(obj:Node):
parent = obj
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func processSelectedObj(delta):
if Input.is_key_pressed(KEY_Z):
add_central_force(Vector3(0.0, 15.0,0.0))
pass
func get_description() -> String:
return name
func capturePossible():
return true
func _integrate_forces(state):
pass
func _on_CubeMobil_input_event(camera, event, click_position, click_normal, shape_idx):
if parent != null and event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
parent.set_selectedObj(self)
"
[sub_resource type="CubeMesh" id=2]
size = Vector3( 1, 0.5, 0.5 )
[sub_resource type="BoxShape" id=3]
extents = Vector3( 0.5, 0.25, 0.25 )
[node name="CubeMobil" type="RigidBody"]
visible = false
script = SubResource( 1 )
[node name="MeshInstance" type="MeshInstance" parent="."]
mesh = SubResource( 2 )
material/0 = null
[node name="CollisionShape" type="CollisionShape" parent="."]
shape = SubResource( 3 )
[node name="HelpDialog" type="WindowDialog" parent="."]
visible = true
margin_right = 276.0
margin_bottom = 173.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RichTextLabel" type="RichTextLabel" parent="HelpDialog"]
margin_left = 18.0
margin_top = 16.0
margin_right = 251.0
margin_bottom = 145.0
text = "A simple box or objet with no particular function, that other devices can move.
"
[connection signal="input_event" from="." to="." method="_on_CubeMobil_input_event"]
[gd_scene load_steps=6 format=2]
[sub_resource type="GDScript" id=1]
script/source = "extends VehicleBody
var parent:Node = null
var dir:float = 0
func set_parent(obj:Node):
parent = obj
#var posCamera:Vector3
#var orientCamera:Vector3
func _ready():
#posCamera = $ViewportContainer/Viewport/CameraImg.get_transform().origin
#orientCamera = $ViewportContainer/Viewport/CameraImg.rotation
#print (\"Orientation:\",orientCamera)
pass # Replace with function body.
func getComm_speed() -> String:
var vit:float = linear_velocity.length()
return String(vit)
func getComm_position() -> String:
return (String(get_global_transform().origin.x) + \",\"
+ String(get_global_transform().origin.z) + \",\"
+ String(get_global_transform().basis.get_euler()[1]))
func getComm_camera() -> String:
#var vit:float = linear_velocity.length()
parent.array_reponse = getImage().save_png_to_buffer()
return \"$ARRAY\"
func setComm_steering(value):
dir = value
steering = value
func setComm_engine(value):
engine_force = value
getComm_speed()
func processSelectedObj(delta):
var force:float = 0.0
if Input.is_key_pressed(KEY_Z): force = 100.0
if Input.is_key_pressed(KEY_S): force = -100.0
engine_force = force
dir = 0.0
if Input.is_key_pressed(KEY_D): dir = -1.0
if Input.is_key_pressed(KEY_Q): dir = 1.0
if Input.is_key_pressed(KEY_SPACE): # inutile
dir = 0.0
engine_force = 0
if steering > dir :
steering = steering - delta
if steering < dir :
steering = steering + delta
func get_description() -> String:
return name + \":\" + \"UglyCar\"
func _process(delta):
test_placeCamera()
pass
func _on_UglyCar_input_event(camera, event, click_position, click_normal, shape_idx):
if parent != null and event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print (\"car Selected\")
parent.set_selectedObj(self)
func getImage():
#$ViewportContainer/Viewport/CameraImg.global_transform=global_transform
#$ViewportContainer/Viewport/CameraImg.translate_object_local(posCamera)
#$ViewportContainer/Viewport/CameraImg.rotate_y(-90)
var img = $Viewport.get_texture().get_data()
#var img = $ViewportContainer/Viewport.get_texture().get_data()
#printt (\"Height=\",img.get_height(),\",width=\",img.get_width(),\"Format=\",img.get_format())
#img.flip_y()
return img
func test_lectPositionCamera():
#return $Camera.global_transform.origin
return $ViewportContainer/Viewport/CameraImg.global_transform.origin
func test_affCamera():
$ViewportContainer.visible = true
func test_placeCamera():
#$ViewportContainer/Viewport/CameraImg.global_transform=$Camera.global_transform
$Viewport/CameraImg.global_transform=$Camera.global_transform
#$ViewportContainer/Viewport/Camera.translate_object_local(posCamera)
#$ViewportContainer/Viewport/Camera.rotate_y(-90)
"
[sub_resource type="BoxShape" id=2]
[sub_resource type="CubeMesh" id=3]
[sub_resource type="CylinderMesh" id=4]
[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0.196078, 0.196078, 0.196078, 1 )
[node name="UglyCar" type="VehicleBody"]
script = SubResource( 1 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 0.4, 0, 0, 0, 0.5, 0, 0.35, 0 )
shape = SubResource( 2 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 0.25, 0, 0, 0, 0.5, 0, 0.491862, 0 )
mesh = SubResource( 3 )
material/0 = null
[node name="VehicleWheel" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 0.75, 0.25, 0.5 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance" type="MeshInstance" parent="VehicleWheel"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel2" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 0.75, 0.25, -0.5 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel2"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel3" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -0.75, 0.25, -0.5 )
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel3"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel4" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -0.75, 0.25, 0.5 )
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel4"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_clear_mode = 2
render_target_update_mode = 3
[node name="CameraImg" type="Camera" parent="Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 2.84217e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
visible = false
[node name="ViewportContainer" type="ViewportContainer" parent="."]
visible = false
margin_left = 651.379
margin_top = 359.077
margin_right = 971.379
margin_bottom = 559.077
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_update_mode = 0
[node name="CameraImg" type="Camera" parent="ViewportContainer/Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 2.84217e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( -1.46362e-07, 0.439249, -0.898365, 7.15628e-08, 0.898365, 0.439249, 1, 0, -1.62921e-07, -2.87524, 2.81332, 0 )
[node name="HelpDialog" type="WindowDialog" parent="."]
visible = true
margin_right = 273.0
margin_bottom = 176.0
[node name="RichTextLabel" type="RichTextLabel" parent="HelpDialog"]
margin_left = 8.0
margin_top = 10.0
margin_right = 262.0
margin_bottom = 163.0
text = "A simple car
- use Z,S,Q,D to move it
- use C to display its camera
"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="input_event" from="." to="." method="_on_UglyCar_input_event"]
[gd_scene load_steps=9 format=2]
[sub_resource type="GDScript" id=1]
script/source = "extends VehicleBody
var parent:Node = null
var dir:float = 0
var hPlate:float = 1
var pickedObj:Node = null
var setForkHeight:float = 1.2
func set_parent(obj:Node):
print (\"UglyStacker, parent:\",obj)
parent = obj
#var posCamera:Vector3
#var orientCamera:Vector3
func _ready():
#posCamera = $ViewportContainer/Viewport/CameraImg.get_transform().origin
#orientCamera = $ViewportContainer/Viewport/CameraImg.rotation
#print (\"Orientation:\",orientCamera)
#print (\"UglyStacker:\",owner)
#$CollisionShape2.transform.origin.y = hPlate
pass # Replace with function body.
func getComm_speed() -> String:
var vit:float = linear_velocity.length()
return String(vit)
func getComm_position() -> String:
return (String(get_global_transform().origin.x) + \",\"
+ String(get_global_transform().origin.z) + \",\"
+ String(get_global_transform().basis.get_euler()[1]))
func getComm_camera() -> String:
#var vit:float = linear_velocity.length()
parent.array_reponse = getImage().save_png_to_buffer()
return \"$ARRAY\"
func getComm_loadState() -> String:
if pickedObj!=null:
return \"Hold:\"+pickedObj.get_description()
if $CollisionShape2/Area.get_overlapping_bodies().size() > 0:
return \"Present Object\"
return \"Void\"
func setComm_steering(value):
dir = value
steering = value
func setComm_engine(value):
engine_force = value
#getComm_speed()
func setComm_forkHeight(value):
setForkHeight = value
#print(value)
func setComm_pick(value):
if pickedObj==null and value>0.5:
var lObj = $CollisionShape2/Area.get_overlapping_bodies()
if lObj.size() > 0:
call_deferred(\"pickObject\",lObj[0])
elif pickedObj!=null and value<0.5:
call_deferred(\"unpickObject\")
#func pickObject_OLD(obj:Node):
# print (\"Capture de \",get_path_to(obj),\",\",typeof(obj))
# if obj.has_method(\"capturePossible\"):
# var newPosition=$CollisionShape2.to_local(obj.global_transform.origin)
# owner.remove_child(obj)
# obj.transform.origin = newPosition
# $CollisionShape2.add_child(obj)
# pickedObj = obj
# else:
# print (\"Oh no, error\")
# pass
#
#func unpickObject_OLD():
# var newPosition=to_global(pickedObj.global_transform.origin)
# $CollisionShape2.remove_child(pickedObj)
# pickedObj.transform.origin = owner.to_local(newPosition)
# owner.add_child(pickedObj)
# pickedObj = null
# pass
var listeColl:Array=[]
func pickObject(obj:Node):
if pickedObj!=null: return
print (\"Capture de \",get_path_to(obj),\",\",typeof(obj))
if obj.has_method(\"capturePossible\"):
for e in obj.get_children():
if e is CollisionShape:
e.disabled = false
var pos2 = e.global_transform
obj.remove_child(e)
listeColl.append(e)
#$CollisionShape2.add_child(e)
add_child(e)
e.set_global_transform(pos2)
var pos = obj.global_transform
owner.remove_child(obj)
obj.set_mode(1) # static
obj.set_use_custom_integrator(true) # pas de memorisation des forces
#$CollisionShape2.add_child_below_node(obj,$CollisionShape2/MeshInstance2)
#$CollisionShape2.add_child(obj)
add_child(obj)
obj.set_global_transform(pos)
pickedObj = obj
print (\"Oh Yes, Catch them all\")
else:
print (\"Oh no, uncatchable\")
func unpickObject():
if pickedObj==null: return
for e in listeColl:
var pos2 = e.global_transform
#$CollisionShape2.remove_child(e)
remove_child(e)
pickedObj.add_child(e)
e.set_global_transform(pos2)
listeColl.clear()
var pos = pickedObj.global_transform
#$CollisionShape2.remove_child(pickedObj)
remove_child(pickedObj)
#remove_child(pickedObj)
pickedObj.set_global_transform(pos)
pickedObj.set_use_custom_integrator(false)
for e in pickedObj.get_children():
if e is CollisionShape:
e.disabled = false
pickedObj.set_mode(0) # MODE_RIGID
owner.add_child(pickedObj)
pickedObj.add_central_force(Vector3(0.0,0.0,0)) # pour reveil
pickedObj = null
print (\"Object dropped\")
#var pickedObjPosition:Vector3 = Vector3(0.0,0.0,0.0)
#func pickObject(obj:Node):
# if pickedObj!=null: return
# print (\"Capture de \",get_path_to(obj),\",\",typeof(obj))
# if obj.has_method(\"capturePossible\"):
# pickedObj = obj
# pickedObjPosition = to_local(obj.global_transform.origin)
# print (\"Oh Yes, Catch them all\")
# else:
# print (\"Oh no, uncatchable\")
#
#func unpickObject():
# if pickedObj==null: return
# pickedObj = null
# print (\"Object dropped\")
#
#func _integrate_forces(state):
# if pickedObj!=null:
# var f1=to_global(pickedObjPosition-pickedObj.global_transform.origin)
# var f2=pickedObj.linear_velocity-linear_velocity
# pickedObj.add_central_force(f1*10.0-f2)
# var xform = state.get_transform()
# state.set_transform(xform)
# pass
func processSelectedObj(delta):
var force:float = 0.0
if Input.is_key_pressed(KEY_Z): force = 200.0
if Input.is_key_pressed(KEY_S): force = -100.0
engine_force = force
dir = 0.0
if Input.is_key_pressed(KEY_D): dir = -1.0
if Input.is_key_pressed(KEY_Q): dir = 1.0
if Input.is_key_pressed(KEY_R): setForkHeight = setForkHeight + delta
if Input.is_key_pressed(KEY_F): setForkHeight = setForkHeight - delta
#hPlate += delta * 1.0
# if Input.is_key_pressed(KEY_F):
# #hPlate -= delta * 1.0
# #$CollisionShape2.transform.origin.y = hPlate
# $CollisionShape2.translate_object_local(Vector3(0.0,-delta * 1.0,0.0))
# if pickedObj!=null:
# pickedObj.translate_object_local(Vector3(0.0,-delta * 1.0,0.0))
# for e in listeColl:
# e.translate_object_local(Vector3(0.0,-delta * 1.0,0.0))
# print('-')
if Input.is_key_pressed(KEY_SPACE): # inutile
dir = 0.0
engine_force = 0
if steering > dir :
steering = steering - delta
if steering < dir :
steering = steering + delta
if Input.is_key_pressed(KEY_W) and pickedObj==null:
var lObj = $CollisionShape2/Area.get_overlapping_bodies()
if lObj.size() > 0:
#pickObject(lObj[0])
call_deferred(\"pickObject\",lObj[0])
if Input.is_key_pressed(KEY_X) and pickedObj!=null:
#unpickObject()
call_deferred(\"unpickObject\")
func get_description() -> String:
return name + \":\" + \"UglyStacker\"
func _process(delta):
test_placeCamera()
if abs(setForkHeight-$CollisionShape2.transform.origin.y)>0.05:
var depl:float = setForkHeight - $CollisionShape2.transform.origin.y
depl = min(delta,max(-delta,depl))
$CollisionShape2.translate_object_local(Vector3(0.0,depl,0.0))
if pickedObj!=null:
pickedObj.translate_object_local(Vector3(0.0,depl,0.0))
for e in listeColl:
e.translate_object_local(Vector3(0.0,depl,0.0))
#print('+')
func _on_UglyCar_input_event(camera, event, click_position, click_normal, shape_idx):
if parent != null and event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print (\"car Selected\")
parent.set_selectedObj(self)
if event.button_index == BUTTON_RIGHT and event.pressed:
print ($CollisionShape2/Area.get_overlapping_bodies())
# if event is InputEventKey:
# if event.pressed and event.scancode == KEY_T:
# print ($CollisionShape2/Area.get_overlapping_bodies())
func getImage():
#$ViewportContainer/Viewport/CameraImg.global_transform=global_transform
#$ViewportContainer/Viewport/CameraImg.translate_object_local(posCamera)
#$ViewportContainer/Viewport/CameraImg.rotate_y(-90)
var img = $Viewport.get_texture().get_data()
#var img = $ViewportContainer/Viewport.get_texture().get_data()
#printt (\"Height=\",img.get_height(),\",width=\",img.get_width(),\"Format=\",img.get_format())
#img.flip_y()
return img
func test_lectPositionCamera():
#return $Camera.global_transform.origin
return $ViewportContainer/Viewport/CameraImg.global_transform.origin
func test_affCamera():
$ViewportContainer.visible = true
func test_placeCamera():
$ViewportContainer/Viewport/CameraImg.global_transform=$Camera.global_transform
$Viewport/CameraImg.global_transform=$Camera.global_transform
#$ViewportContainer/Viewport/Camera.translate_object_local(posCamera)
#$ViewportContainer/Viewport/Camera.rotate_y(-90)
func _on_Area_body_entered(body):
#print (\"Arrive de \",body.get_path())
print (\"Arrive de \",get_path_to(body),\",\",typeof(body))
# if body.has_method(\"capturePossible\"):
# var newPosition=to_local(body.global_transform.origin)
# owner.remove_child(body)
# $CollisionShape2.add_child(body)
# body.transform.origin = newPosition
pass # Replace with function body.
func _on_Area_body_exited(body):
print (\"Depart de \",body.get_path())
print (\"Depart de \",get_path_to(body))
pass # Replace with function body.
"
[sub_resource type="BoxShape" id=2]
[sub_resource type="CubeMesh" id=3]
[sub_resource type="CylinderMesh" id=4]
[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0.196078, 0.196078, 0.196078, 1 )
[sub_resource type="BoxShape" id=6]
extents = Vector3( 0.1, 0.5, 0.5 )
[sub_resource type="CubeMesh" id=7]
size = Vector3( 0.1, 1, 0.2 )
[sub_resource type="BoxShape" id=8]
[node name="UglyCar" type="VehicleBody"]
script = SubResource( 1 )
[node name="CollisionShape" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 0.4, 0, 0, 0, 0.5, 0, 0.35, 0 )
shape = SubResource( 2 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 0.25, 0, 0, 0, 0.5, 0, 0.491862, 0 )
mesh = SubResource( 3 )
material/0 = null
[node name="VehicleWheel" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 0.75, 0.25, 0.5 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance" type="MeshInstance" parent="VehicleWheel"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel2" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, 0.75, 0.25, -0.5 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel2"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel3" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -0.75, 0.25, -0.5 )
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel3"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="VehicleWheel4" type="VehicleWheel" parent="."]
transform = Transform( -1.62921e-07, 0, 1, 0, 1, 0, -1, 0, -1.62921e-07, -0.75, 0.25, 0.5 )
wheel_radius = 0.25
wheel_rest_length = 0.1
[node name="MeshInstance2" type="MeshInstance" parent="VehicleWheel4"]
transform = Transform( -4.07302e-08, 0.1, -4.07302e-08, 0, -1.62921e-08, -0.25, -0.25, -1.62921e-08, 6.63579e-15, 0, 0, 0 )
mesh = SubResource( 4 )
material/0 = SubResource( 5 )
[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_clear_mode = 2
render_target_update_mode = 3
[node name="CameraImg" type="Camera" parent="Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 2.84217e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
[node name="ViewportContainer" type="ViewportContainer" parent="."]
visible = false
margin_left = 651.379
margin_top = 359.077
margin_right = 971.379
margin_bottom = 559.077
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Viewport" type="Viewport" parent="ViewportContainer"]
size = Vector2( 320, 200 )
handle_input_locally = false
render_target_v_flip = true
render_target_update_mode = 0
[node name="CameraImg" type="Camera" parent="ViewportContainer/Viewport"]
transform = Transform( -1.59788e-07, 0.195159, -0.980772, 3.17954e-08, 0.980772, 0.195159, 1, 2.84217e-14, -1.62921e-07, -3.89679, 0.468328, 0 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( -1.46362e-07, 0.439249, -0.898365, 7.15628e-08, 0.898365, 0.439249, 1, 0, -1.62921e-07, -2.87524, 2.81332, 0 )
[node name="CollisionShape2" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.3, 1.2, 0 )
shape = SubResource( 6 )
[node name="MeshInstance2" type="MeshInstance" parent="CollisionShape2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.374106 )
mesh = SubResource( 7 )
material/0 = null
[node name="MeshInstance3" type="MeshInstance" parent="CollisionShape2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.314626 )
mesh = SubResource( 7 )
material/0 = null
[node name="Area" type="Area" parent="CollisionShape2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.89165, 0, 0 )
gravity_vec = Vector3( -1, 0, 0 )
gravity = 20.0
[node name="CollisionShape" type="CollisionShape" parent="CollisionShape2/Area"]
transform = Transform( 0.05, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.63614, 0, 0 )
shape = SubResource( 8 )
[node name="HelpDialog" type="WindowDialog" parent="."]
visible = true
margin_right = 292.0
margin_bottom = 195.0
[node name="RichTextLabel" type="RichTextLabel" parent="HelpDialog"]
margin_left = 17.3529
margin_top = 10.6787
margin_right = 269.353
margin_bottom = 165.679
text = "A simple forklift
- use Z,S,Q,D to move it
- use R,F to lift up or down grip
- use W to catch a box, X to release it
- use C to display its camera"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="input_event" from="." to="." method="_on_UglyCar_input_event"]
[connection signal="body_entered" from="CollisionShape2/Area" to="." method="_on_Area_body_entered"]
[connection signal="body_exited" from="CollisionShape2/Area" to="." method="_on_Area_body_exited"]
[gd_scene load_steps=5 format=2]
[sub_resource type="CylinderMesh" id=1]
top_radius = 0.001
bottom_radius = 0.2
height = 0.5
[sub_resource type="SpatialMaterial" id=2]
albedo_color = Color( 0.752941, 0.0588235, 0.0588235, 1 )
[sub_resource type="GDScript" id=3]
script/source = "extends MeshInstance
# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func getComm_position() -> String:
var pos = get_global_transform().origin
return (String(pos.x) + \",\"
+ String(pos.z))
func get_description() -> String:
return name + \":\" + \"spatialPoint\"
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func processSelectedObj(delta):
pass
func _on_Area_input_event(camera, event, click_position, click_normal, shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
owner.set_selectedObj(self)
"
[sub_resource type="CylinderShape" id=4]
radius = 0.2
height = 0.5
[node name="Spatial" type="MeshInstance"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0 )
visible = false
mesh = SubResource( 1 )
material/0 = SubResource( 2 )
script = SubResource( 3 )
[node name="Area" type="Area" parent="."]
[node name="CollisionShape" type="CollisionShape" parent="Area"]
shape = SubResource( 4 )
[node name="HelpDialog" type="WindowDialog" parent="."]
margin_left = 7.0
margin_top = -4.0
margin_right = 280.0
margin_bottom = 134.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RichTextLabel" type="RichTextLabel" parent="HelpDialog"]
margin_left = 17.0
margin_top = 21.0
margin_right = 241.0
margin_bottom = 113.0
text = "A spatial mark, used to define a (target) position"
[connection signal="input_event" from="Area" to="." method="_on_Area_input_event"]
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )
SimulSPEED/icon.png

3.23 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment