-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hakim Rouatbi
committed
Apr 1, 2019
0 parents
commit 2c3a26d
Showing
12 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source_md5="8dd9ff1eebf38898a54579d8c01b0a88" | ||
dest_md5="f313a3b659325769abce8a76c1dc02fe" | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[sub_resource type="CubeMesh" id=1] | ||
|
||
[sub_resource type="ConvexPolygonShape" id=2] | ||
points = PoolVector3Array( -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, -1, -1, -1, 1, -1, 1, -1, -1 ) | ||
|
||
[node name="Block" type="MeshInstance"] | ||
mesh = SubResource( 1 ) | ||
material/0 = null | ||
|
||
[node name="StaticBody" type="StaticBody" parent="."] | ||
|
||
[node name="CollisionShape" type="CollisionShape" parent="StaticBody"] | ||
shape = SubResource( 2 ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
extends Spatial | ||
|
||
const MOUSE_SENSITIVITY = 0.001 | ||
|
||
func _ready(): | ||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) | ||
|
||
func _process(delta): | ||
if Input.is_action_just_pressed("ui_cancel"): | ||
disable_capture() | ||
pass | ||
|
||
func _input(event): | ||
if event is InputEventMouseMotion: | ||
rotate_y(-event.relative.x * MOUSE_SENSITIVITY) | ||
$Camera.rotate_x(-event.relative.y * MOUSE_SENSITIVITY) | ||
|
||
func disable_capture(): | ||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Godot FPS example | ||
|
||
This is an example of how to make an FPS camera in Godot using GDScript. | ||
|
||
It show the utility of a camera helper, so that the camera rotates on only one axis, avoiding its transform to get messed up. | ||
|
||
The version used is Godot 3.1 stable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[gd_scene load_steps=6 format=2] | ||
|
||
[ext_resource path="res://CamHelper.gd" type="Script" id=1] | ||
[ext_resource path="res://Block.tscn" type="PackedScene" id=2] | ||
|
||
[sub_resource type="SpatialMaterial" id=1] | ||
albedo_color = Color( 0.843137, 0.729412, 0.729412, 1 ) | ||
|
||
[sub_resource type="SpatialMaterial" id=2] | ||
albedo_color = Color( 0.196078, 0.215686, 0.764706, 1 ) | ||
|
||
[sub_resource type="SpatialMaterial" id=3] | ||
albedo_color = Color( 0.807843, 0.137255, 0.137255, 1 ) | ||
|
||
[node name="World" type="Spatial"] | ||
|
||
[node name="CamHelper" type="Spatial" parent="."] | ||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6314, 4.51168 ) | ||
script = ExtResource( 1 ) | ||
|
||
[node name="Camera" type="Camera" parent="CamHelper"] | ||
|
||
[node name="DirectionalLight" type="DirectionalLight" parent="."] | ||
transform = Transform( 0.164943, -0.572657, 0.80303, 0.442731, 0.770535, 0.458547, -0.881353, 0.279892, 0.380627, 16.5946, 5.28802, 0 ) | ||
shadow_enabled = true | ||
|
||
[node name="Walls" type="Spatial" parent="."] | ||
editor/display_folded = true | ||
|
||
[node name="Ground" parent="Walls" instance=ExtResource( 2 )] | ||
transform = Transform( 5.21155, 0, 0, 0, 0.12543, 0, 0, 0, 5.83496, 0, 0, 0 ) | ||
material/0 = SubResource( 1 ) | ||
|
||
[node name="Block2" parent="Walls" instance=ExtResource( 2 )] | ||
transform = Transform( 0.334481, 0, 0, 0, 1, 0, 0, 0, 0.29742, -1.3442, 1.12543, 0.230633 ) | ||
material/0 = SubResource( 2 ) | ||
|
||
[node name="Block3" parent="Walls" instance=ExtResource( 2 )] | ||
transform = Transform( 0.334481, 0, 0, 0, 1, 0, 0, 0, 0.29742, 1.85091, 1.12543, -1.97344 ) | ||
material/0 = SubResource( 3 ) | ||
|
||
[node name="Block4" parent="Walls" instance=ExtResource( 2 )] | ||
transform = Transform( 0.33448, 0, 0, 0, 0.391074, 0, 0, 0, 0.29742, 1.66935, 0.453213, 0.790159 ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[gd_resource type="Environment" load_steps=2 format=2] | ||
|
||
[sub_resource type="ProceduralSky" id=1] | ||
|
||
[resource] | ||
background_mode = 2 | ||
background_sky = SubResource( 1 ) | ||
ssao_radius = 0.1 | ||
ssao_intensity = 12.3 | ||
ssao_intensity2 = 0.0 | ||
ssao_quality = 1 | ||
glow_bloom = 0.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="StreamTexture" | ||
path.s3tc="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.stex" | ||
path.etc2="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.etc2.stex" | ||
metadata={ | ||
"imported_formats": [ "s3tc", "etc2" ], | ||
"vram_texture": true | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://icon.png" | ||
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.stex", "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.etc2.stex" ] | ||
|
||
[params] | ||
|
||
compress/mode=2 | ||
compress/lossy_quality=0.7 | ||
compress/hdr_mode=0 | ||
compress/bptc_ldr=0 | ||
compress/normal_map=0 | ||
flags/repeat=true | ||
flags/filter=true | ||
flags/mipmaps=true | ||
flags/anisotropic=false | ||
flags/srgb=1 | ||
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=false | ||
svg/scale=1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
; Engine configuration file. | ||
; It's best edited using the editor UI and not directly, | ||
; since the parameters that go here are not all obvious. | ||
; | ||
; Format: | ||
; [section] ; section goes between [] | ||
; param=value ; assign values to parameters | ||
|
||
config_version=4 | ||
|
||
_global_script_classes=[ ] | ||
_global_script_class_icons={ | ||
|
||
} | ||
|
||
[application] | ||
|
||
config/name="FPS" | ||
run/main_scene="res://World.tscn" | ||
config/icon="res://icon.png" | ||
|
||
[rendering] | ||
|
||
environment/default_environment="res://default_env.tres" |