Experimenting with export and movement
parent
d2cef63a12
commit
761d9064e1
|
@ -0,0 +1,205 @@
|
||||||
|
[preset.0]
|
||||||
|
|
||||||
|
name="GodotComponentTest"
|
||||||
|
platform="Android"
|
||||||
|
runnable=true
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="./GodotComponentTest.apk"
|
||||||
|
script_export_mode=1
|
||||||
|
script_encryption_key=""
|
||||||
|
|
||||||
|
[preset.0.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
custom_template/use_custom_build=false
|
||||||
|
custom_template/export_format=0
|
||||||
|
architectures/armeabi-v7a=true
|
||||||
|
architectures/arm64-v8a=true
|
||||||
|
architectures/x86=false
|
||||||
|
architectures/x86_64=false
|
||||||
|
keystore/debug=""
|
||||||
|
keystore/debug_user=""
|
||||||
|
keystore/debug_password=""
|
||||||
|
keystore/release=""
|
||||||
|
keystore/release_user=""
|
||||||
|
keystore/release_password=""
|
||||||
|
one_click_deploy/clear_previous_install=true
|
||||||
|
version/code=1
|
||||||
|
version/name="1.0"
|
||||||
|
version/min_sdk=19
|
||||||
|
version/target_sdk=30
|
||||||
|
package/unique_name="org.godotengine.$genname"
|
||||||
|
package/name=""
|
||||||
|
package/signed=true
|
||||||
|
package/classify_as_game=true
|
||||||
|
package/retain_data_on_uninstall=false
|
||||||
|
package/exclude_from_recents=false
|
||||||
|
launcher_icons/main_192x192=""
|
||||||
|
launcher_icons/adaptive_foreground_432x432=""
|
||||||
|
launcher_icons/adaptive_background_432x432=""
|
||||||
|
graphics/32_bits_framebuffer=true
|
||||||
|
graphics/opengl_debug=false
|
||||||
|
xr_features/xr_mode=0
|
||||||
|
xr_features/hand_tracking=0
|
||||||
|
xr_features/hand_tracking_frequency=0
|
||||||
|
xr_features/passthrough=0
|
||||||
|
screen/immersive_mode=true
|
||||||
|
screen/support_small=true
|
||||||
|
screen/support_normal=true
|
||||||
|
screen/support_large=true
|
||||||
|
screen/support_xlarge=true
|
||||||
|
user_data_backup/allow=false
|
||||||
|
command_line/extra_args=""
|
||||||
|
apk_expansion/enable=false
|
||||||
|
apk_expansion/SALT=""
|
||||||
|
apk_expansion/public_key=""
|
||||||
|
permissions/custom_permissions=PoolStringArray( )
|
||||||
|
permissions/access_checkin_properties=false
|
||||||
|
permissions/access_coarse_location=false
|
||||||
|
permissions/access_fine_location=false
|
||||||
|
permissions/access_location_extra_commands=false
|
||||||
|
permissions/access_mock_location=false
|
||||||
|
permissions/access_network_state=false
|
||||||
|
permissions/access_surface_flinger=false
|
||||||
|
permissions/access_wifi_state=false
|
||||||
|
permissions/account_manager=false
|
||||||
|
permissions/add_voicemail=false
|
||||||
|
permissions/authenticate_accounts=false
|
||||||
|
permissions/battery_stats=false
|
||||||
|
permissions/bind_accessibility_service=false
|
||||||
|
permissions/bind_appwidget=false
|
||||||
|
permissions/bind_device_admin=false
|
||||||
|
permissions/bind_input_method=false
|
||||||
|
permissions/bind_nfc_service=false
|
||||||
|
permissions/bind_notification_listener_service=false
|
||||||
|
permissions/bind_print_service=false
|
||||||
|
permissions/bind_remoteviews=false
|
||||||
|
permissions/bind_text_service=false
|
||||||
|
permissions/bind_vpn_service=false
|
||||||
|
permissions/bind_wallpaper=false
|
||||||
|
permissions/bluetooth=false
|
||||||
|
permissions/bluetooth_admin=false
|
||||||
|
permissions/bluetooth_privileged=false
|
||||||
|
permissions/brick=false
|
||||||
|
permissions/broadcast_package_removed=false
|
||||||
|
permissions/broadcast_sms=false
|
||||||
|
permissions/broadcast_sticky=false
|
||||||
|
permissions/broadcast_wap_push=false
|
||||||
|
permissions/call_phone=false
|
||||||
|
permissions/call_privileged=false
|
||||||
|
permissions/camera=false
|
||||||
|
permissions/capture_audio_output=false
|
||||||
|
permissions/capture_secure_video_output=false
|
||||||
|
permissions/capture_video_output=false
|
||||||
|
permissions/change_component_enabled_state=false
|
||||||
|
permissions/change_configuration=false
|
||||||
|
permissions/change_network_state=false
|
||||||
|
permissions/change_wifi_multicast_state=false
|
||||||
|
permissions/change_wifi_state=false
|
||||||
|
permissions/clear_app_cache=false
|
||||||
|
permissions/clear_app_user_data=false
|
||||||
|
permissions/control_location_updates=false
|
||||||
|
permissions/delete_cache_files=false
|
||||||
|
permissions/delete_packages=false
|
||||||
|
permissions/device_power=false
|
||||||
|
permissions/diagnostic=false
|
||||||
|
permissions/disable_keyguard=false
|
||||||
|
permissions/dump=false
|
||||||
|
permissions/expand_status_bar=false
|
||||||
|
permissions/factory_test=false
|
||||||
|
permissions/flashlight=false
|
||||||
|
permissions/force_back=false
|
||||||
|
permissions/get_accounts=false
|
||||||
|
permissions/get_package_size=false
|
||||||
|
permissions/get_tasks=false
|
||||||
|
permissions/get_top_activity_info=false
|
||||||
|
permissions/global_search=false
|
||||||
|
permissions/hardware_test=false
|
||||||
|
permissions/inject_events=false
|
||||||
|
permissions/install_location_provider=false
|
||||||
|
permissions/install_packages=false
|
||||||
|
permissions/install_shortcut=false
|
||||||
|
permissions/internal_system_window=false
|
||||||
|
permissions/internet=false
|
||||||
|
permissions/kill_background_processes=false
|
||||||
|
permissions/location_hardware=false
|
||||||
|
permissions/manage_accounts=false
|
||||||
|
permissions/manage_app_tokens=false
|
||||||
|
permissions/manage_documents=false
|
||||||
|
permissions/master_clear=false
|
||||||
|
permissions/media_content_control=false
|
||||||
|
permissions/modify_audio_settings=false
|
||||||
|
permissions/modify_phone_state=false
|
||||||
|
permissions/mount_format_filesystems=false
|
||||||
|
permissions/mount_unmount_filesystems=false
|
||||||
|
permissions/nfc=false
|
||||||
|
permissions/persistent_activity=false
|
||||||
|
permissions/process_outgoing_calls=false
|
||||||
|
permissions/read_calendar=false
|
||||||
|
permissions/read_call_log=false
|
||||||
|
permissions/read_contacts=false
|
||||||
|
permissions/read_external_storage=false
|
||||||
|
permissions/read_frame_buffer=false
|
||||||
|
permissions/read_history_bookmarks=false
|
||||||
|
permissions/read_input_state=false
|
||||||
|
permissions/read_logs=false
|
||||||
|
permissions/read_phone_state=false
|
||||||
|
permissions/read_profile=false
|
||||||
|
permissions/read_sms=false
|
||||||
|
permissions/read_social_stream=false
|
||||||
|
permissions/read_sync_settings=false
|
||||||
|
permissions/read_sync_stats=false
|
||||||
|
permissions/read_user_dictionary=false
|
||||||
|
permissions/reboot=false
|
||||||
|
permissions/receive_boot_completed=false
|
||||||
|
permissions/receive_mms=false
|
||||||
|
permissions/receive_sms=false
|
||||||
|
permissions/receive_wap_push=false
|
||||||
|
permissions/record_audio=false
|
||||||
|
permissions/reorder_tasks=false
|
||||||
|
permissions/restart_packages=false
|
||||||
|
permissions/send_respond_via_message=false
|
||||||
|
permissions/send_sms=false
|
||||||
|
permissions/set_activity_watcher=false
|
||||||
|
permissions/set_alarm=false
|
||||||
|
permissions/set_always_finish=false
|
||||||
|
permissions/set_animation_scale=false
|
||||||
|
permissions/set_debug_app=false
|
||||||
|
permissions/set_orientation=false
|
||||||
|
permissions/set_pointer_speed=false
|
||||||
|
permissions/set_preferred_applications=false
|
||||||
|
permissions/set_process_limit=false
|
||||||
|
permissions/set_time=false
|
||||||
|
permissions/set_time_zone=false
|
||||||
|
permissions/set_wallpaper=false
|
||||||
|
permissions/set_wallpaper_hints=false
|
||||||
|
permissions/signal_persistent_processes=false
|
||||||
|
permissions/status_bar=false
|
||||||
|
permissions/subscribed_feeds_read=false
|
||||||
|
permissions/subscribed_feeds_write=false
|
||||||
|
permissions/system_alert_window=false
|
||||||
|
permissions/transmit_ir=false
|
||||||
|
permissions/uninstall_shortcut=false
|
||||||
|
permissions/update_device_stats=false
|
||||||
|
permissions/use_credentials=false
|
||||||
|
permissions/use_sip=false
|
||||||
|
permissions/vibrate=false
|
||||||
|
permissions/wake_lock=false
|
||||||
|
permissions/write_apn_settings=false
|
||||||
|
permissions/write_calendar=false
|
||||||
|
permissions/write_call_log=false
|
||||||
|
permissions/write_contacts=false
|
||||||
|
permissions/write_external_storage=false
|
||||||
|
permissions/write_gservices=false
|
||||||
|
permissions/write_history_bookmarks=false
|
||||||
|
permissions/write_profile=false
|
||||||
|
permissions/write_secure_settings=false
|
||||||
|
permissions/write_settings=false
|
||||||
|
permissions/write_sms=false
|
||||||
|
permissions/write_social_stream=false
|
||||||
|
permissions/write_sync_settings=false
|
||||||
|
permissions/write_user_dictionary=false
|
|
@ -45,13 +45,15 @@ _global_script_class_icons={
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="GodotComponentTest"
|
config/name="GodotComponentTest"
|
||||||
run/main_scene="res://Game.tscn"
|
run/main_scene="res://scenes/HexGrid3DTest.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/width=1280
|
window/size/width=320
|
||||||
window/size/height=768
|
window/size/height=400
|
||||||
|
window/stretch/mode="viewport"
|
||||||
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,14 @@ extends Spatial
|
||||||
|
|
||||||
onready var hexgrid = preload("res://addons/gdhexgrid/HexGrid.gd").new()
|
onready var hexgrid = preload("res://addons/gdhexgrid/HexGrid.gd").new()
|
||||||
onready var HexTile3D = preload("res://scenes/HexTile3D.tscn")
|
onready var HexTile3D = preload("res://scenes/HexTile3D.tscn")
|
||||||
|
onready var tiles = $Tiles
|
||||||
|
onready var fps_label = $CanvasLayer/HBoxContainer/FPSLabel
|
||||||
|
onready var player_pos_label = $CanvasLayer/HBoxContainer/PlayerPos
|
||||||
|
onready var player = $Player
|
||||||
|
|
||||||
|
var player_velocity = Vector3.ZERO
|
||||||
|
var player_speed = 10
|
||||||
|
var target_coordinate = Vector3.ZERO
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
print (hexgrid)
|
print (hexgrid)
|
||||||
|
@ -15,7 +23,8 @@ func _ready():
|
||||||
var tile = HexTile3D.instance()
|
var tile = HexTile3D.instance()
|
||||||
var height = (sin(pos.y * 0.3) * sin(pos.y * 0.8) * 0.8 + cos ((pos.x) * 0.9) * 1.24) * 0.5 - 0.5
|
var height = (sin(pos.y * 0.3) * sin(pos.y * 0.8) * 0.8 + cos ((pos.x) * 0.9) * 1.24) * 0.5 - 0.5
|
||||||
tile.transform.origin = Vector3(pos.x, height, pos.y)
|
tile.transform.origin = Vector3(pos.x, height, pos.y)
|
||||||
add_child(tile)
|
tile.connect("tile_selected", self, "on_tile_selected")
|
||||||
|
tiles.add_child(tile)
|
||||||
|
|
||||||
var pos = hexgrid.get_hex_center3(Vector3(0, 0, 0))
|
var pos = hexgrid.get_hex_center3(Vector3(0, 0, 0))
|
||||||
print (pos)
|
print (pos)
|
||||||
|
@ -24,3 +33,27 @@ func _ready():
|
||||||
print (hex)
|
print (hex)
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
fps_label.text = "FPS: " + str(Performance.get_monitor(Performance.TIME_FPS))
|
||||||
|
player_pos_label.text = "Pos: " + str(player.transform.origin)
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
var position_error = target_coordinate - player.transform.origin
|
||||||
|
var error_length = position_error.length()
|
||||||
|
|
||||||
|
if error_length > 0.1:
|
||||||
|
player_velocity = position_error / error_length * player_speed
|
||||||
|
else:
|
||||||
|
player_velocity = Vector3.ZERO
|
||||||
|
|
||||||
|
player.transform.origin += player_velocity * delta
|
||||||
|
|
||||||
|
|
||||||
|
func on_tile_selected(tile):
|
||||||
|
target_coordinate = Vector3(tile.transform.origin.x, 0, tile.transform.origin.z)
|
||||||
|
var position_error = target_coordinate - player.transform.origin
|
||||||
|
print ("clicked on tile " + str(tile.transform.origin) + " error: " + str(position_error))
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,23 @@ size = Vector2( 50, 50 )
|
||||||
[sub_resource type="Shader" id=2]
|
[sub_resource type="Shader" id=2]
|
||||||
code = "shader_type spatial;
|
code = "shader_type spatial;
|
||||||
|
|
||||||
uniform float beer_factor = 5.0;
|
uniform vec2 amplitude = vec2(0.01, 0.05);
|
||||||
|
uniform vec2 frequency = vec2(3.0, 2.5);
|
||||||
|
uniform vec2 time_factor = vec2(2.0, 3.0);
|
||||||
|
|
||||||
|
uniform float beer_factor = 100.01;
|
||||||
|
uniform float refraction = 0.05;
|
||||||
|
|
||||||
|
float height(vec2 pos, float time) {
|
||||||
|
return (amplitude.x * sin(pos.x * frequency.x + time * time_factor.x)) + (amplitude.y * sin(pos.y * frequency.y + time * time_factor.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
void vertex() {
|
||||||
|
//VERTEX.y += height(VERTEX.xz, TIME); // sample the height at the location of our vertex
|
||||||
|
TANGENT = normalize(vec3(0.0, height(VERTEX.xz + vec2(0.0, 0.2), TIME) - height(VERTEX.xz + vec2(0.0, -0.2), TIME), 0.4));
|
||||||
|
BINORMAL = normalize(vec3(0.4, height(VERTEX.xz + vec2(0.2, 0.0), TIME) - height(VERTEX.xz + vec2(-0.2, 0.0), TIME ), 0.0));
|
||||||
|
NORMAL = cross(TANGENT, BINORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
// sample our depth buffer
|
// sample our depth buffer
|
||||||
|
@ -32,12 +48,24 @@ void fragment() {
|
||||||
|
|
||||||
ALPHA = clamp(1.0 - att, 0.0, 1.0);
|
ALPHA = clamp(1.0 - att, 0.0, 1.0);
|
||||||
|
|
||||||
|
vec3 ref_normal = normalize( mix(NORMAL,TANGENT * NORMALMAP.x + BINORMAL * NORMALMAP.y + NORMAL * NORMALMAP.z,NORMALMAP_DEPTH) );
|
||||||
|
vec2 ref_ofs = SCREEN_UV - ref_normal.xy * refraction;
|
||||||
|
EMISSION += textureLod(SCREEN_TEXTURE,ref_ofs,ROUGHNESS * 2.0).rgb * (1.0 - ALPHA);
|
||||||
|
|
||||||
ALBEDO = vec3(0.0, 0.0, 0.05);
|
ALBEDO = vec3(0.0, 0.0, 0.05);
|
||||||
|
|
||||||
|
|
||||||
|
ALBEDO *= ALPHA;
|
||||||
|
//ALPHA = 1.0;
|
||||||
}"
|
}"
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id=3]
|
[sub_resource type="ShaderMaterial" id=3]
|
||||||
shader = SubResource( 2 )
|
shader = SubResource( 2 )
|
||||||
|
shader_param/amplitude = Vector2( 0.01, 0.05 )
|
||||||
|
shader_param/frequency = Vector2( 3, 2.5 )
|
||||||
|
shader_param/time_factor = Vector2( 2, 3 )
|
||||||
shader_param/beer_factor = 5.0
|
shader_param/beer_factor = 5.0
|
||||||
|
shader_param/refraction = 0.05
|
||||||
|
|
||||||
[node name="HexGrid3DTest" type="Spatial"]
|
[node name="HexGrid3DTest" type="Spatial"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
@ -45,17 +73,50 @@ script = ExtResource( 2 )
|
||||||
[node name="HexTile3D" parent="." instance=ExtResource( 1 )]
|
[node name="HexTile3D" parent="." instance=ExtResource( 1 )]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="Camera" type="Camera" parent="."]
|
|
||||||
transform = Transform( 1, 0, 0, 0, 0.511698, 0.859165, 0, -0.859165, 0.511698, -1.05655, 3.66248, 10.3074 )
|
|
||||||
fov = 60.0
|
|
||||||
script = ExtResource( 3 )
|
|
||||||
|
|
||||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||||
transform = Transform( 0.83729, 0.174005, 0.518332, -0.54676, 0.266466, 0.793757, 0, -0.948008, 0.318248, 0, 8.03448, 0 )
|
transform = Transform( 0.83729, 0.174005, 0.518332, -0.54676, 0.266466, 0.793757, 0, -0.948008, 0.318248, 0, 8.03448, 0 )
|
||||||
|
visible = false
|
||||||
shadow_enabled = true
|
shadow_enabled = true
|
||||||
shadow_contact = 1.565
|
shadow_contact = 1.565
|
||||||
|
|
||||||
[node name="MeshInstance" type="MeshInstance" parent="."]
|
[node name="Water" type="MeshInstance" parent="."]
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.568377, 0.0356998 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.568377, 0.0356998 )
|
||||||
mesh = SubResource( 1 )
|
mesh = SubResource( 1 )
|
||||||
material/0 = SubResource( 3 )
|
material/0 = SubResource( 3 )
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer"]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="FPSLabel" type="Label" parent="CanvasLayer/HBoxContainer"]
|
||||||
|
margin_top = 13.0
|
||||||
|
margin_right = 22.0
|
||||||
|
margin_bottom = 27.0
|
||||||
|
text = "FPS"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="PlayerPos" type="Label" parent="CanvasLayer/HBoxContainer"]
|
||||||
|
margin_left = 26.0
|
||||||
|
margin_top = 13.0
|
||||||
|
margin_right = 88.0
|
||||||
|
margin_bottom = 27.0
|
||||||
|
text = "PlayerPos"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Tiles" type="Spatial" parent="."]
|
||||||
|
|
||||||
|
[node name="Player" type="Spatial" parent="."]
|
||||||
|
|
||||||
|
[node name="Camera" type="Camera" parent="Player"]
|
||||||
|
transform = Transform( 1, 0, 0, 0, 0.511698, 0.859165, 0, -0.859165, 0.511698, -1.05655, 3.66248, 10.3074 )
|
||||||
|
fov = 60.0
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
|
|
@ -3,6 +3,8 @@ extends MeshInstance
|
||||||
onready var is_mouse_over = false
|
onready var is_mouse_over = false
|
||||||
var old_material_override = Material.new()
|
var old_material_override = Material.new()
|
||||||
|
|
||||||
|
signal tile_selected
|
||||||
|
|
||||||
func _on_Area_mouse_entered():
|
func _on_Area_mouse_entered():
|
||||||
is_mouse_over = true
|
is_mouse_over = true
|
||||||
old_material_override = material_override
|
old_material_override = material_override
|
||||||
|
@ -12,6 +14,13 @@ func _on_Area_mouse_entered():
|
||||||
cloned_material.albedo_color = Color (1, 0, 0)
|
cloned_material.albedo_color = Color (1, 0, 0)
|
||||||
self.material_override = cloned_material
|
self.material_override = cloned_material
|
||||||
|
|
||||||
|
|
||||||
func _on_Area_mouse_exited():
|
func _on_Area_mouse_exited():
|
||||||
is_mouse_over = false
|
is_mouse_over = false
|
||||||
self.material_override = old_material_override
|
self.material_override = old_material_override
|
||||||
|
|
||||||
|
|
||||||
|
func _on_Area_input_event(camera, event, position, normal, shape_idx):
|
||||||
|
if is_mouse_over and event is InputEventMouseButton:
|
||||||
|
if event.button_index == 1 and event.pressed:
|
||||||
|
emit_signal("tile_selected", self)
|
||||||
|
|
|
@ -28,5 +28,6 @@ script = ExtResource( 1 )
|
||||||
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
||||||
shape = SubResource( 5 )
|
shape = SubResource( 5 )
|
||||||
|
|
||||||
|
[connection signal="input_event" from="Area" to="." method="_on_Area_input_event"]
|
||||||
[connection signal="mouse_entered" from="Area" to="." method="_on_Area_mouse_entered"]
|
[connection signal="mouse_entered" from="Area" to="." method="_on_Area_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="Area" to="." method="_on_Area_mouse_exited"]
|
[connection signal="mouse_exited" from="Area" to="." method="_on_Area_mouse_exited"]
|
||||||
|
|
Loading…
Reference in New Issue