Better bullet traces and raycast for hitscan
This commit is contained in:
parent
1c8458048c
commit
7da4a3d6bb
BIN
Screenshots/Godot_icon.png
(Stored with Git LFS)
BIN
Screenshots/Godot_icon.png
(Stored with Git LFS)
Binary file not shown.
@ -1,220 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="1024"
|
||||
height="1024"
|
||||
id="svg3030"
|
||||
version="1.1"
|
||||
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
|
||||
sodipodi:docname="Godot_icon.svg"
|
||||
inkscape:export-filename="/home/bence/Documents/GodotMirror/Screenshots/Godot_icon.svg.png"
|
||||
inkscape:export-xdpi="24"
|
||||
inkscape:export-ydpi="24">
|
||||
<defs
|
||||
id="defs3032" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.7"
|
||||
inkscape:cx="454.17422"
|
||||
inkscape:cy="511.72319"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="g1049"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1016"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:document-rotation="0" />
|
||||
<metadata
|
||||
id="metadata3035">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-98.519719)">
|
||||
<g
|
||||
id="g1049">
|
||||
<path
|
||||
id="rect1129"
|
||||
style="fill:#ececec;stroke:#000000;stroke-width:37.583;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stop-color:#000000;opacity:1;fill-opacity:1;stroke-linejoin:round"
|
||||
d="M 39.535993,146.47003 553.73185,331.49989 V 894.11097 L 39.535993,1079.1409 Z"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<g
|
||||
id="g1127"
|
||||
transform="matrix(1.0517442,0,0,1.0517442,-126.67183,-45.231534)">
|
||||
<g
|
||||
id="g1065"
|
||||
transform="translate(168.57143,10)">
|
||||
<g
|
||||
id="g78"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,885.69963,674.45569)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c 0,0 -0.325,1.994 -0.515,1.976 l -36.182,-3.491 c -2.879,-0.278 -5.115,-2.574 -5.317,-5.459 l -0.994,-14.247 -27.992,-1.997 -1.904,12.912 c -0.424,2.872 -2.932,5.037 -5.835,5.037 h -38.188 c -2.902,0 -5.41,-2.165 -5.834,-5.037 l -1.905,-12.912 -27.992,1.997 -0.994,14.247 c -0.202,2.886 -2.438,5.182 -5.317,5.46 l -36.2,3.49 c -0.187,0.018 -0.324,-1.978 -0.511,-1.978 l -0.049,-7.83 30.658,-4.944 1.004,-14.374 c 0.203,-2.91 2.551,-5.263 5.463,-5.472 l 38.551,-2.75 c 0.146,-0.01 0.29,-0.016 0.434,-0.016 2.897,0 5.401,2.166 5.825,5.038 l 1.959,13.286 h 28.005 l 1.959,-13.286 c 0.423,-2.871 2.93,-5.037 5.831,-5.037 0.142,0 0.284,0.005 0.423,0.015 l 38.556,2.75 c 2.911,0.209 5.26,2.562 5.463,5.472 l 1.003,14.374 30.645,4.966 z"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path80"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g82-3"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,555.4187,574.80276)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 v -47.514 -6.035 -5.492 c 0.108,-0.001 0.216,-0.005 0.323,-0.015 l 36.196,-3.49 c 1.896,-0.183 3.382,-1.709 3.514,-3.609 l 1.116,-15.978 31.574,-2.253 2.175,14.747 c 0.282,1.912 1.922,3.329 3.856,3.329 h 38.188 c 1.933,0 3.573,-1.417 3.855,-3.329 l 2.175,-14.747 31.575,2.253 1.115,15.978 c 0.133,1.9 1.618,3.425 3.514,3.609 l 36.182,3.49 c 0.107,0.01 0.214,0.014 0.322,0.015 v 4.711 l 0.015,0.005 V 0 h 0.134 c 4.795,6.12 9.232,12.569 13.487,19.449 -5.651,9.62 -12.575,18.217 -19.976,26.182 -6.864,-3.455 -13.531,-7.369 -19.828,-11.534 -3.151,3.132 -6.7,5.694 -10.186,8.372 -3.425,2.751 -7.285,4.768 -10.946,7.118 1.09,8.117 1.629,16.108 1.846,24.448 -9.446,4.754 -19.519,7.906 -29.708,10.17 -4.068,-6.837 -7.788,-14.241 -11.028,-21.479 -3.842,0.642 -7.702,0.88 -11.567,0.926 v 0.006 c -0.027,0 -0.052,-0.006 -0.075,-0.006 -0.024,0 -0.049,0.006 -0.073,0.006 V 63.652 C 93.903,63.606 90.046,63.368 86.203,62.726 82.965,69.964 79.247,77.368 75.173,84.205 64.989,81.941 54.915,78.789 45.47,74.035 45.686,65.695 46.225,57.704 47.318,49.587 43.65,47.237 39.795,45.22 36.369,42.469 32.888,39.791 29.333,37.229 26.181,34.097 19.884,38.262 13.219,42.176 6.353,45.631 -1.048,37.666 -7.968,29.069 -13.621,19.449 -9.368,12.569 -4.928,6.12 -0.134,0 Z"
|
||||
style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path84-6"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g86-7"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,830.89115,692.93384)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 -1.121,-16.063 c -0.135,-1.936 -1.675,-3.477 -3.611,-3.616 l -38.555,-2.751 c -0.094,-0.007 -0.188,-0.01 -0.281,-0.01 -1.916,0 -3.569,1.406 -3.852,3.33 l -2.211,14.994 H -81.09 l -2.211,-14.994 c -0.297,-2.018 -2.101,-3.469 -4.133,-3.32 l -38.555,2.751 c -1.936,0.139 -3.476,1.68 -3.611,3.616 L -130.721,0 -163.268,3.138 c 0.015,-3.498 0.06,-7.33 0.06,-8.093 0,-34.374 43.605,-50.896 97.781,-51.086 h 0.066 0.067 c 54.176,0.19 97.766,16.712 97.766,51.086 0,0.777 0.047,4.593 0.063,8.093 z"
|
||||
style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path88-5"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g90-3"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,670.78441,615.25518)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m -22.024595,1.6720738 c -12.042,0 -25.67305,-13.0143828 -21.598405,-1.6720738 3.739059,10.408162 17.019368,10.676839 21.492607,10.693249 C -17.657154,10.709659 -2.7380023,7.1323685 0,0 2.7380023,-7.1323685 -9.9765953,1.6720738 -22.024595,1.6720738 Z"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path92-5"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sszzs" />
|
||||
</g>
|
||||
<g
|
||||
id="g98-9"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,720.56874,655.42554)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c -3.878,0 -7.021,2.858 -7.021,6.381 v 20.081 c 0,3.52 3.143,6.381 7.021,6.381 3.878,0 7.028,-2.861 7.028,-6.381 V 6.381 C 7.028,2.858 3.878,0 0,0"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path100-1"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g102-2"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,770.35921,615.25518)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c 0,-12.052 9.765,-21.815 21.815,-21.815 12.041,0 21.808,9.763 21.808,21.815 0,12.044 -9.767,21.802 -21.808,21.802 C 9.765,21.802 0,12.044 0,0"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path104-7"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g106-0"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,779.22038,617.43899)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c 0,-7.994 6.477,-14.473 14.471,-14.473 8.002,0 14.479,6.479 14.479,14.473 0,7.994 -6.477,14.479 -14.479,14.479 C 6.477,14.479 0,7.994 0,0"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path108-9"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g1095"
|
||||
transform="matrix(-1,0,0,1,1125.4286,10)">
|
||||
<g
|
||||
id="g1069"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,885.69963,674.45569)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c 0,0 -0.325,1.994 -0.515,1.976 l -36.182,-3.491 c -2.879,-0.278 -5.115,-2.574 -5.317,-5.459 l -0.994,-14.247 -27.992,-1.997 -1.904,12.912 c -0.424,2.872 -2.932,5.037 -5.835,5.037 h -38.188 c -2.902,0 -5.41,-2.165 -5.834,-5.037 l -1.905,-12.912 -27.992,1.997 -0.994,14.247 c -0.202,2.886 -2.438,5.182 -5.317,5.46 l -36.2,3.49 c -0.187,0.018 -0.324,-1.978 -0.511,-1.978 l -0.049,-7.83 30.658,-4.944 1.004,-14.374 c 0.203,-2.91 2.551,-5.263 5.463,-5.472 l 38.551,-2.75 c 0.146,-0.01 0.29,-0.016 0.434,-0.016 2.897,0 5.401,2.166 5.825,5.038 l 1.959,13.286 h 28.005 l 1.959,-13.286 c 0.423,-2.871 2.93,-5.037 5.831,-5.037 0.142,0 0.284,0.005 0.423,0.015 l 38.556,2.75 c 2.911,0.209 5.26,2.562 5.463,5.472 l 1.003,14.374 30.645,4.966 z"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path1067"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g1073"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,555.4187,574.80276)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 v -47.514 -6.035 -5.492 c 0.108,-0.001 0.216,-0.005 0.323,-0.015 l 36.196,-3.49 c 1.896,-0.183 3.382,-1.709 3.514,-3.609 l 1.116,-15.978 31.574,-2.253 2.175,14.747 c 0.282,1.912 1.922,3.329 3.856,3.329 h 38.188 c 1.933,0 3.573,-1.417 3.855,-3.329 l 2.175,-14.747 31.575,2.253 1.115,15.978 c 0.133,1.9 1.618,3.425 3.514,3.609 l 36.182,3.49 c 0.107,0.01 0.214,0.014 0.322,0.015 v 4.711 l 0.015,0.005 V 0 h 0.134 c 4.795,6.12 9.232,12.569 13.487,19.449 -5.651,9.62 -12.575,18.217 -19.976,26.182 -6.864,-3.455 -13.531,-7.369 -19.828,-11.534 -3.151,3.132 -6.7,5.694 -10.186,8.372 -3.425,2.751 -7.285,4.768 -10.946,7.118 1.09,8.117 1.629,16.108 1.846,24.448 -9.446,4.754 -19.519,7.906 -29.708,10.17 -4.068,-6.837 -7.788,-14.241 -11.028,-21.479 -3.842,0.642 -7.702,0.88 -11.567,0.926 v 0.006 c -0.027,0 -0.052,-0.006 -0.075,-0.006 -0.024,0 -0.049,0.006 -0.073,0.006 V 63.652 C 93.903,63.606 90.046,63.368 86.203,62.726 82.965,69.964 79.247,77.368 75.173,84.205 64.989,81.941 54.915,78.789 45.47,74.035 45.686,65.695 46.225,57.704 47.318,49.587 43.65,47.237 39.795,45.22 36.369,42.469 32.888,39.791 29.333,37.229 26.181,34.097 19.884,38.262 13.219,42.176 6.353,45.631 -1.048,37.666 -7.968,29.069 -13.621,19.449 -9.368,12.569 -4.928,6.12 -0.134,0 Z"
|
||||
style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path1071"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g1077"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,830.89115,692.93384)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 -1.121,-16.063 c -0.135,-1.936 -1.675,-3.477 -3.611,-3.616 l -38.555,-2.751 c -0.094,-0.007 -0.188,-0.01 -0.281,-0.01 -1.916,0 -3.569,1.406 -3.852,3.33 l -2.211,14.994 H -81.09 l -2.211,-14.994 c -0.297,-2.018 -2.101,-3.469 -4.133,-3.32 l -38.555,2.751 c -1.936,0.139 -3.476,1.68 -3.611,3.616 L -130.721,0 -163.268,3.138 c 0.015,-3.498 0.06,-7.33 0.06,-8.093 0,-34.374 43.605,-50.896 97.781,-51.086 h 0.066 0.067 c 54.176,0.19 97.766,16.712 97.766,51.086 0,0.777 0.047,4.593 0.063,8.093 z"
|
||||
style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path1075"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g1081"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,670.78441,615.25518)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m -22.024595,1.6720738 c -12.042,0 -25.67305,-13.0143828 -21.598405,-1.6720738 3.739059,10.408162 17.019368,10.676839 21.492607,10.693249 C -17.657154,10.709659 -2.7380023,7.1323685 0,0 2.7380023,-7.1323685 -9.9765953,1.6720738 -22.024595,1.6720738 Z"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path1079"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="sszzs" />
|
||||
</g>
|
||||
<g
|
||||
id="g1085"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,720.56874,655.42554)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c -3.878,0 -7.021,2.858 -7.021,6.381 v 20.081 c 0,3.52 3.143,6.381 7.021,6.381 3.878,0 7.028,-2.861 7.028,-6.381 V 6.381 C 7.028,2.858 3.878,0 0,0"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path1083"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g1089"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,770.35921,615.25518)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c 0,-12.052 9.765,-21.815 21.815,-21.815 12.041,0 21.808,9.763 21.808,21.815 0,12.044 -9.767,21.802 -21.808,21.802 C 9.765,21.802 0,12.044 0,0"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path1087"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="g1093"
|
||||
transform="matrix(1.6878585,0,0,-1.6878585,779.22038,617.43899)"
|
||||
style="stroke-width:0.320312">
|
||||
<path
|
||||
d="m 0,0 c 0,-7.994 6.477,-14.473 14.471,-14.473 8.002,0 14.479,6.479 14.479,14.473 0,7.994 -6.477,14.479 -14.479,14.479 C 6.477,14.479 0,7.994 0,0"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.320312"
|
||||
id="path1091"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 14 KiB |
BIN
Screenshots/Mirror.png
(Stored with Git LFS)
BIN
Screenshots/Mirror.png
(Stored with Git LFS)
Binary file not shown.
@ -3,25 +3,26 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://coqym2otrhygu"
|
||||
path="res://.godot/imported/texture_02.png-bb6eefc15212ba5b8098e9e672c21f12.ctex"
|
||||
path.s3tc="res://.godot/imported/texture_02.png-bb6eefc15212ba5b8098e9e672c21f12.s3tc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/kenney_prototype_textures/red/texture_02.png"
|
||||
dest_files=["res://.godot/imported/texture_02.png-bb6eefc15212ba5b8098e9e672c21f12.ctex"]
|
||||
dest_files=["res://.godot/imported/texture_02.png-bb6eefc15212ba5b8098e9e672c21f12.s3tc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/generate=true
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
@ -31,4 +32,4 @@ process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
detect_3d/compress_to=0
|
||||
|
BIN
assets/crosshairs/crosshair_default.png
(Stored with Git LFS)
Normal file
BIN
assets/crosshairs/crosshair_default.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/crosshairs/crosshair_default.png.import
(Stored with Git LFS)
Normal file
BIN
assets/crosshairs/crosshair_default.png.import
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -30,6 +30,11 @@ window/size/borderless=true
|
||||
|
||||
import/blender/enabled=false
|
||||
|
||||
[global_group]
|
||||
|
||||
body=""
|
||||
target=""
|
||||
|
||||
[input]
|
||||
|
||||
move_left={
|
||||
|
16
scenes/characters/blue/dummy.gd
Normal file
16
scenes/characters/blue/dummy.gd
Normal file
@ -0,0 +1,16 @@
|
||||
extends Node3D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_head_collision_body_part_hit(dam: Variant) -> void:
|
||||
print("head is hit")
|
||||
pass # Replace with function body.
|
@ -1,4 +1,7 @@
|
||||
[gd_scene load_steps=9 format=4 uid="uid://1txob6jskn5s"]
|
||||
[gd_scene load_steps=12 format=4 uid="uid://1txob6jskn5s"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/characters/blue/dummy.gd" id="1_cyeub"]
|
||||
[ext_resource type="Script" path="res://scenes/characters/blue/head_collision.gd" id="1_lianf"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gqjtb"]
|
||||
resource_name = "Alpha_Joints_MAT"
|
||||
@ -255,6 +258,10 @@ blend_shape_mode = 0
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j3emx"]
|
||||
albedo_color = Color(0, 0, 1, 1)
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_k5bjr"]
|
||||
radius = 11.245
|
||||
height = 27.8
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6g1lc"]
|
||||
resource_name = "Run Forward"
|
||||
length = 0.533333
|
||||
@ -861,6 +868,7 @@ _data = {
|
||||
|
||||
[node name="Dummy" type="Node3D"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
script = ExtResource("1_cyeub")
|
||||
|
||||
[node name="Body" type="Node3D" parent="."]
|
||||
|
||||
@ -1333,7 +1341,25 @@ mesh = SubResource("ArrayMesh_8h4ki")
|
||||
skin = SubResource("Skin_hwx5g")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_j3emx")
|
||||
|
||||
[node name="HitCollisions" type="Node3D" parent="Body/Armature/Skeleton3D"]
|
||||
|
||||
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="Body/Armature/Skeleton3D"]
|
||||
transform = Transform3D(0.978017, -0.176546, -0.110972, 0.15839, 0.282801, 0.94601, -0.135631, -0.942791, 0.304547, -11.8203, 17.7472, -135.936)
|
||||
bone_name = "mixamorig_Head"
|
||||
bone_idx = 5
|
||||
|
||||
[node name="HeadCollision" type="Area3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D" groups=["body"]]
|
||||
transform = Transform3D(9.90229, 1.3945, -6.09554e-08, 0, -4.37114e-07, -10, -1.3945, 9.90229, -4.32843e-07, 0.58762, 7.43451, 1.4646)
|
||||
script = ExtResource("1_lianf")
|
||||
|
||||
[node name="Collision" type="CollisionShape3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D/HeadCollision"]
|
||||
shape = SubResource("CapsuleShape3D_k5bjr")
|
||||
|
||||
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Body/Armature/Skeleton3D/BoneAttachment3D"]
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Body"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_dbxeu")
|
||||
}
|
||||
|
||||
[connection signal="body_part_hit" from="Body/Armature/Skeleton3D/BoneAttachment3D/HeadCollision" to="." method="_on_head_collision_body_part_hit"]
|
||||
|
16
scenes/characters/blue/head_collision.gd
Normal file
16
scenes/characters/blue/head_collision.gd
Normal file
@ -0,0 +1,16 @@
|
||||
extends Area3D
|
||||
|
||||
@export var damage: int = 100
|
||||
|
||||
signal body_part_hit(dam)
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func hit():
|
||||
emit_signal("body_part_hit", damage)
|
@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://b10lpwfjgxds4"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://b10lpwfjgxds4"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/player/player_input_controller.gd" id="1_q75ai"]
|
||||
[ext_resource type="Texture2D" uid="uid://oopj5mj1vdp0" path="res://assets/crosshairs/crosshair_default.png" id="2_lsd7c"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jc50w"]
|
||||
radius = 0.3
|
||||
@ -90,7 +91,11 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.609154, 0)
|
||||
fov = 40.0
|
||||
|
||||
[node name="BulletStartingPoint" type="Node3D" parent="FirstPersonCameraMount"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, -0.343115)
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, -0.42185)
|
||||
|
||||
[node name="AimRay" type="RayCast3D" parent="FirstPersonCameraMount/BulletStartingPoint"]
|
||||
target_position = Vector3(0, 0, 1000)
|
||||
hit_from_inside = true
|
||||
|
||||
[node name="GunMount" type="Node3D" parent="FirstPersonCameraMount"]
|
||||
|
||||
@ -99,5 +104,31 @@ libraries = {
|
||||
"": SubResource("AnimationLibrary_u1b6p")
|
||||
}
|
||||
|
||||
[node name="HUD" type="Control" parent="FirstPersonCameraMount"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 8.0
|
||||
offset_right = 8.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="FirstPersonCameraMount/HUD"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -36.0
|
||||
offset_top = -36.0
|
||||
offset_right = 36.0
|
||||
offset_bottom = 36.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_lsd7c")
|
||||
|
||||
[node name="ModelMount" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.790262, 0)
|
||||
|
15
scenes/maps/csg_box_3d.gd
Normal file
15
scenes/maps/csg_box_3d.gd
Normal file
@ -0,0 +1,15 @@
|
||||
extends CSGBox3D
|
||||
|
||||
var health = 5
|
||||
|
||||
func take_damage():
|
||||
health -= 1
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if health < 1:
|
||||
queue_free()
|
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,9 @@ extends Node3D
|
||||
|
||||
const SPEED = 715
|
||||
|
||||
@onready var mesh = $MeshInstance3D
|
||||
@onready var ray = $RayCast3D
|
||||
@onready var mesh = $RigidBody3D/MeshInstance3D
|
||||
@onready var rigid_body_3d: RigidBody3D = $RigidBody3D
|
||||
@onready var ray = $RigidBody3D/RayCast3D
|
||||
@onready var particles = $GPUParticles3D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@ -14,11 +15,15 @@ func _ready() -> void:
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
position += transform.basis * Vector3(0, 0, SPEED) * delta
|
||||
ray.collision_mask = 1
|
||||
ray.enabled = 1
|
||||
rigid_body_3d.set_use_continuous_collision_detection(true)
|
||||
#ray.collision_mask = 1
|
||||
#ray.enabled = 1
|
||||
ray.target_position.z = SPEED / Engine.get_frames_per_second()
|
||||
if ray.is_colliding():
|
||||
mesh.visible = false
|
||||
rigid_body_3d.visible = false
|
||||
particles.emitting = true
|
||||
#if ray.get_collider().is_in_group("body"):
|
||||
#print("head")
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
queue_free()
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://b0agqeg53tey5"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://b0agqeg53tey5"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/weapon/bullet.gd" id="1_th28m"]
|
||||
|
||||
@ -8,6 +8,10 @@ size = Vector3(0.2, 0.2, 0.5)
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_p8o05"]
|
||||
albedo_color = Color(0.894987, 0.000702324, 0.905119, 1)
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_l3sdq"]
|
||||
height = 0.3
|
||||
radius = 0.08
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ynv38"]
|
||||
albedo_color = Color(0.929412, 0, 0, 1)
|
||||
emission_enabled = true
|
||||
@ -27,33 +31,42 @@ linear_accel_max = 6.67
|
||||
size = Vector3(0.05, 0.05, 0.05)
|
||||
|
||||
[node name="Bullet" type="Node3D"]
|
||||
visible = false
|
||||
script = ExtResource("1_th28m")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
[node name="RigidBody3D" type="RigidBody3D" parent="."]
|
||||
mass = 0.01
|
||||
continuous_cd = true
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
|
||||
transform = Transform3D(0.663102, 0, 0, 0, 0.601826, 0, 0, 0, 0.58984, 0, 0, 0)
|
||||
mesh = SubResource("BoxMesh_vxst2")
|
||||
skeleton = NodePath("../..")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_p8o05")
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.100459)
|
||||
target_position = Vector3(0, 0, -0.5)
|
||||
[node name="RayCast3D" type="RayCast3D" parent="RigidBody3D" groups=["body"]]
|
||||
exclude_parent = false
|
||||
target_position = Vector3(0, 0, 2)
|
||||
hit_back_faces = false
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="Timer" type="Timer" parent="RigidBody3D"]
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
|
||||
shape = SubResource("CylinderShape3D_l3sdq")
|
||||
|
||||
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.18476)
|
||||
material_override = SubResource("StandardMaterial3D_ynv38")
|
||||
emitting = false
|
||||
amount = 10
|
||||
lifetime = 6.29
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
process_material = SubResource("ParticleProcessMaterial_58cgi")
|
||||
draw_pass_1 = SubResource("BoxMesh_mfkmi")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
[connection signal="timeout" from="RigidBody3D/Timer" to="." method="_on_timer_timeout"]
|
||||
|
@ -3,7 +3,6 @@ extends Node3D
|
||||
const SPEED = 715
|
||||
|
||||
@onready var mesh = $Object_10
|
||||
@onready var trace = $Trace
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
@ -13,12 +12,6 @@ func _ready() -> void:
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
position += transform.basis * Vector3(0, 0, SPEED) * delta
|
||||
trace.collision_mask = 1
|
||||
trace.enabled = 1
|
||||
if trace.is_colliding():
|
||||
mesh.visible = false
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_timer_timeout():
|
||||
|
@ -52,9 +52,5 @@ transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0,
|
||||
mesh = SubResource("ArrayMesh_uqgp1")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="Trace" type="RayCast3D" parent="."]
|
||||
target_position = Vector3(0, 0, 1)
|
||||
hit_back_faces = false
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.2
|
||||
|
@ -4,23 +4,30 @@ extends Node3D
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
@onready var barrel: Node3D = $Barrel
|
||||
@onready var bullet_trace_distance: Node3D = $BulletTraceDistance
|
||||
@onready var bullet_trail_end: Node3D = $BulletTrailEnd
|
||||
|
||||
func shoot() -> Error:
|
||||
var bullet_start_node: Node3D = bullet_trace_distance.find_child("Start")
|
||||
var bullet_end_node: Node3D = bullet_trace_distance.find_child("End")
|
||||
if bullet_start_node and bullet_end_node:
|
||||
var path := "res://scenes/weapon/misc/bullet_trail_generic.tscn"
|
||||
if not ResourceLoader.exists(path):
|
||||
return ERR_DOES_NOT_EXIST
|
||||
var scene: PackedScene = ResourceLoader.load(path)
|
||||
if not scene.can_instantiate():
|
||||
return ERR_CANT_OPEN
|
||||
|
||||
var node: MeshInstance3D = scene.instantiate()
|
||||
node.init(bullet_start_node.global_position, bullet_end_node.global_position)
|
||||
var root := get_tree().get_root()
|
||||
root.add_child(node)
|
||||
return OK
|
||||
else:
|
||||
push_warning("Couldn't generate a bullet trace, no distance node found")
|
||||
return ERR_BUG
|
||||
# -- TODO: It should not be hardcoded
|
||||
var path := "res://scenes/weapon/guns/ak/bullet.tscn"
|
||||
if not ResourceLoader.exists(path):
|
||||
return ERR_DOES_NOT_EXIST
|
||||
var scene: PackedScene = ResourceLoader.load(path)
|
||||
if not scene.can_instantiate():
|
||||
return ERR_CANT_OPEN
|
||||
var node: Node3D = scene.instantiate()
|
||||
var root := get_tree().get_root()
|
||||
node.position = barrel.global_position
|
||||
node.transform.basis = barrel.global_transform.basis
|
||||
root.add_child(node)
|
||||
return OK
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
@ -1,7 +1,8 @@
|
||||
[gd_scene load_steps=54 format=4 uid="uid://dtvo21mk1webd"]
|
||||
[gd_scene load_steps=55 format=4 uid="uid://dtvo21mk1webd"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/weapon/guns/ak/with_hands.gd" id="1_2iqts"]
|
||||
[ext_resource type="PackedScene" uid="uid://dab7jttp7ywfh" path="res://scenes/weapon/guns/ak/gun.tscn" id="1_aaafm"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjyltbtx45cqs" path="res://scenes/weapon/misc/bullet_trace_distance.tscn" id="3_5ff4y"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tg27p"]
|
||||
|
||||
@ -734,5 +735,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.286444, 0, -0.397435)
|
||||
mesh = SubResource("ArrayMesh_kj4i3")
|
||||
skeleton = NodePath("")
|
||||
|
||||
[node name="Barrel" type="Node3D" parent="."]
|
||||
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 0.161938, -4.38604)
|
||||
[node name="BulletTraceDistance" parent="." instance=ExtResource("3_5ff4y")]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -3.86167e-07, 0.200684, -4.41724)
|
||||
|
8
scenes/weapon/misc/bullet_trace_distance.tscn
Normal file
8
scenes/weapon/misc/bullet_trace_distance.tscn
Normal file
@ -0,0 +1,8 @@
|
||||
[gd_scene format=3 uid="uid://bjyltbtx45cqs"]
|
||||
|
||||
[node name="BulletTraceDistance" type="Node3D"]
|
||||
|
||||
[node name="Start" type="Node3D" parent="."]
|
||||
|
||||
[node name="End" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 300)
|
22
scenes/weapon/misc/bullet_trail_generic.gd
Normal file
22
scenes/weapon/misc/bullet_trail_generic.gd
Normal file
@ -0,0 +1,22 @@
|
||||
extends MeshInstance3D
|
||||
|
||||
func init(pos1, pos2):
|
||||
var draw_mesh := ImmediateMesh.new()
|
||||
mesh = draw_mesh
|
||||
draw_mesh.surface_begin(Mesh.PRIMITIVE_LINES, material_override)
|
||||
draw_mesh.surface_add_vertex(pos1)
|
||||
draw_mesh.surface_add_vertex(pos2)
|
||||
draw_mesh.surface_end()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
queue_free()
|
20
scenes/weapon/misc/bullet_trail_generic.tscn
Normal file
20
scenes/weapon/misc/bullet_trail_generic.tscn
Normal file
@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://balgqtw1ijpw3"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/weapon/misc/bullet_trail_generic.gd" id="1_k8eg1"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ybqvs"]
|
||||
albedo_color = Color(0.934388, 0.967243, 0.955863, 1)
|
||||
emission = Color(1, 1, 1, 1)
|
||||
emission_energy_multiplier = 2.7
|
||||
|
||||
[node name="BulletTrailGeneric" type="MeshInstance3D"]
|
||||
material_override = SubResource("StandardMaterial3D_ybqvs")
|
||||
visibility_range_end = 1891.27
|
||||
script = ExtResource("1_k8eg1")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.05
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
3
scenes/weapon/misc/muzzle_flash.tscn
Normal file
3
scenes/weapon/misc/muzzle_flash.tscn
Normal file
@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://bfelcp5dmag5r"]
|
||||
|
||||
[node name="MuzzleFlash" type="MeshInstance3D"]
|
@ -3,6 +3,8 @@
|
||||
# ---------------------------------------------------------------------
|
||||
class_name PlayerInput extends CharacterBody3D
|
||||
|
||||
var health: int = 100
|
||||
|
||||
@export_category("PlayerInput")
|
||||
|
||||
const SPEED = 5.0
|
||||
@ -160,15 +162,39 @@ var bullet = load("res://scenes/weapon/bullet.tscn")
|
||||
|
||||
@onready var shooting_raycast: RayCast3D = $FirstPersonCameraMount/RayCast3D
|
||||
@onready var bullet_starting_point: Node3D = $FirstPersonCameraMount/BulletStartingPoint
|
||||
|
||||
@onready var aim_ray: RayCast3D = $FirstPersonCameraMount/BulletStartingPoint/AimRay
|
||||
# --find the gun node and exec shoot
|
||||
func _shoot():
|
||||
if aim_ray.is_colliding():
|
||||
var collider := aim_ray.get_collider()
|
||||
if collider != null and collider.is_in_group("target"):
|
||||
aim_ray.get_collider().take_damage()
|
||||
var root := get_tree().get_root()
|
||||
#if !gun_anim.is_playing():
|
||||
#gun_anim.play("Shoot")
|
||||
gun_with_hands.shoot()
|
||||
#gun_mount_anim.play("shooting")
|
||||
var node: Node3D = bullet.instantiate()
|
||||
node.position = bullet_starting_point.global_position
|
||||
node.transform.basis = bullet_starting_point.global_transform.basis
|
||||
root.add_child(node)
|
||||
|
||||
func _get_camera_collision():
|
||||
var viewport = get_viewport().size
|
||||
var ray_origin = first_view_camera.project_ray_origin(viewport / 2)
|
||||
var ray_end = ray_origin + first_view_camera.project_ray_normal(viewport / 2 * 100)
|
||||
var new_intersection = PhysicsRayQueryParameters3D.create(ray_origin, ray_end)
|
||||
var intersection = get_world_3d().direct_space_state.intersect_ray(new_intersection)
|
||||
if not intersection.is_empty():
|
||||
var collision_point = intersection.position
|
||||
print("gotcha")
|
||||
return collision_point
|
||||
else:
|
||||
return ray_end
|
||||
|
||||
func _hit_scan_collision(collision_point):
|
||||
var viewport = get_viewport().size
|
||||
var ray_origin = first_view_camera.project_ray_origin(viewport / 2)
|
||||
var ray_end = ray_origin + first_view_camera.project_ray_normal(viewport / 2 * 100)
|
||||
var new_intersection = PhysicsRayQueryParameters3D.create(ray_origin, ray_end)
|
||||
var bullet_collision = get_world_3d().direct_space_state.intersect_ray(new_intersection)
|
||||
if bullet_collision:
|
||||
print(bullet_collision)
|
||||
_hit_scan_damage(bullet_collision.collider)
|
||||
|
||||
func _hit_scan_damage(Collider):
|
||||
#if Collider.is_in_group("target") and Collider.has_method("take_damage"):
|
||||
print("damaged")
|
||||
|
16
shaders/highlight.gdshader
Normal file
16
shaders/highlight.gdshader
Normal file
@ -0,0 +1,16 @@
|
||||
shader_type spatial;
|
||||
render_mode unshaded, depth_draw_never;
|
||||
|
||||
uniform vec4 shine_color : source_color = vec4( 1.0, 1.0, 1.0, 1.0 );
|
||||
uniform float cycle_interval : hint_range(0.5, 5.0) = 1.0;
|
||||
uniform float shine_speed : hint_range(1.0, 5.0) = 3.0;
|
||||
uniform float shine_width : hint_range(1.0, 100.0) = 3.0;
|
||||
|
||||
void fragment( )
|
||||
{
|
||||
vec3 vertex = ( INV_VIEW_MATRIX * vec4( VERTEX, 1.0 ) ).xyz;
|
||||
float width = shine_width * 0.001 * cycle_interval;
|
||||
float frequency = floor( sin( vertex.z * cycle_interval + TIME * shine_speed * cycle_interval ) + width );
|
||||
ALBEDO = shine_color.rgb;
|
||||
ALPHA = clamp( ( 1.0 - dot( NORMAL, VIEW ) ) * frequency * shine_color.a, 0.0, 1.0 );
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user