Basic spaceship movement, better physics engine
This commit is contained in:
parent
33ee749178
commit
44b8a3ef8c
80 changed files with 1833 additions and 0 deletions
3
addons/godot-rapier2d/Fluid2D.svg
Normal file
3
addons/godot-rapier2d/Fluid2D.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<svg height="16" width="16" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;">
|
||||||
|
<path d="M8.378,13.915C8.378,13.915 5.426,14.047 4.724,10.406C4.746,6.98 8.051,2.631 8.051,2.631C8.051,2.631 10.859,4.921 11.682,10.223C11.472,13.834 8.378,13.915 8.378,13.915Z" style="fill:none;fill-rule:nonzero;stroke:rgb(141,165,243);stroke-width:2px;"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 555 B |
44
addons/godot-rapier2d/Fluid2D.svg.import
Normal file
44
addons/godot-rapier2d/Fluid2D.svg.import
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cv17s0qjrqj16"
|
||||||
|
path="res://.godot/imported/Fluid2D.svg-947567c51a8b586a0e695be7cba2d975.ctex"
|
||||||
|
metadata={
|
||||||
|
"has_editor_variant": true,
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/godot-rapier2d/Fluid2D.svg"
|
||||||
|
dest_files=["res://.godot/imported/Fluid2D.svg-947567c51a8b586a0e695be7cba2d975.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
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
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=true
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
21
addons/godot-rapier2d/LICENSE
Normal file
21
addons/godot-rapier2d/LICENSE
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Fabrice Cipolla, Sp3ctralCat and Dragos Daian
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
10
addons/godot-rapier2d/Radial2D.svg
Normal file
10
addons/godot-rapier2d/Radial2D.svg
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="100%" height="100%" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||||
|
<g transform="matrix(1.56913,0,0,1.56913,-4.55301,-4.55301)">
|
||||||
|
<circle cx="8" cy="8" r="5" style="fill:url(#_Radial1);"/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="_Radial1" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="matrix(4.14354,-2.64625,2.64625,4.14354,8.03935,7.99693)"><stop offset="0" style="stop-color:white;stop-opacity:1"/><stop offset="0.52" style="stop-color:white;stop-opacity:0.76"/><stop offset="1" style="stop-color:white;stop-opacity:0"/></radialGradient>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 979 B |
44
addons/godot-rapier2d/Radial2D.svg.import
Normal file
44
addons/godot-rapier2d/Radial2D.svg.import
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cho3shol3rky2"
|
||||||
|
path="res://.godot/imported/Radial2D.svg-4380d9841bddc115105cff2016be7c6a.ctex"
|
||||||
|
metadata={
|
||||||
|
"has_editor_variant": true,
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/godot-rapier2d/Radial2D.svg"
|
||||||
|
dest_files=["res://.godot/imported/Radial2D.svg-4380d9841bddc115105cff2016be7c6a.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
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
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=true
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
||||||
288
addons/godot-rapier2d/THIRDPARTY.txt
Normal file
288
addons/godot-rapier2d/THIRDPARTY.txt
Normal file
|
|
@ -0,0 +1,288 @@
|
||||||
|
Godot Rapier incorporates third-party material from the projects listed below.
|
||||||
|
|
||||||
|
Godot Engine (https://github.com/godotengine/godot)
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md).
|
||||||
|
Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
||||||
|
|
||||||
|
godot-cpp (https://github.com/godotengine/godot-cpp)
|
||||||
|
|
||||||
|
Copyright (c) 2017-present Godot Engine contributors.
|
||||||
|
Copyright (c) 2022-present Mikael Hermansson.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
deal in the Software without restriction, including without limitation the
|
||||||
|
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
IN THE SOFTWARE.
|
||||||
|
|
||||||
|
rapier (https://github.com/dimforge/rapier)
|
||||||
|
|
||||||
|
Copyright 2020 Sébastien Crozet
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
Godot Jolt (https://github.com/godot-jolt/godot-jolt)
|
||||||
|
|
||||||
|
Copyright (c) Mikael Hermansson and Godot Jolt contributors.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
salva (https://github.com/dimforge/salva)
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright 2020 Sébastien Crozet
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
BIN
addons/godot-rapier2d/bin/godot_rapier.wasm
Normal file
BIN
addons/godot-rapier2d/bin/godot_rapier.wasm
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>libgodot_rapier.ios.arm64</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Godot Rapier2D</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>Godot Rapier2D</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.godot-rapier2d.godot-rapier2d</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright (c) 2023-present Fabrice Cipolla, Sp3ctralCat and Dragos Daian.</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>0.12.0</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>0.12.0</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>DTPlatformName</key>
|
||||||
|
<string>iphoneos</string>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>12.0</string>
|
||||||
|
<!--
|
||||||
|
From https://github.com/godot-jolt/godot-jolt/
|
||||||
|
-->
|
||||||
|
<key>AvailableLibraries</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>BinaryPath</key>
|
||||||
|
<string>libgodot_rapier.ios.arm64.dylib</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Binary file not shown.
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>libgodot_rapier.ios.x86_64</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Godot Rapier2D</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>Godot Rapier2D</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.godot-rapier2d.godot-rapier2d</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright (c) 2023-present Fabrice Cipolla, Sp3ctralCat and Dragos Daian.</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>0.12.0</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>0.12.0</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>DTPlatformName</key>
|
||||||
|
<string>iphoneos</string>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>12.0</string>
|
||||||
|
<!--
|
||||||
|
From https://github.com/godot-jolt/godot-jolt/
|
||||||
|
-->
|
||||||
|
<key>AvailableLibraries</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>BinaryPath</key>
|
||||||
|
<string>libgodot_rapier.ios.x86_64.dylib</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>libgodot_rapier.macos.dylib</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.godot-rapier2d.godot-rapier2d</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>Godot Rapier2D</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0.0</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>Copyright (c) 2023-present Fabrice Cipolla, Sp3ctralCat and Dragos Daian.</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0.0</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.12</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>files</key>
|
||||||
|
<dict>
|
||||||
|
<key>Resources/Info.plist</key>
|
||||||
|
<data>
|
||||||
|
FZy7+eYDJuYSbntBY+mwtyopSvE=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>files2</key>
|
||||||
|
<dict>
|
||||||
|
<key>Resources/Info.plist</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
MMDYIVdI76poLGbcF02jJpJ+oHcs7q1NjyfgsaN1jus=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>rules</key>
|
||||||
|
<dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version.plist$</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>rules2</key>
|
||||||
|
<dict>
|
||||||
|
<key>.*\.dSYM($|/)</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>11</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(.*/)?\.DS_Store$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>2000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^.*</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Info\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^PkgInfo$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^[^/]+$</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^embedded\.provisionprofile$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
addons/godot-rapier2d/bin/wasm-nothreads/godot_rapier.wasm
Normal file
BIN
addons/godot-rapier2d/bin/wasm-nothreads/godot_rapier.wasm
Normal file
Binary file not shown.
15
addons/godot-rapier2d/circle_mesh.tres
Normal file
15
addons/godot-rapier2d/circle_mesh.tres
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
[gd_resource type="ArrayMesh" format=3 uid="uid://dahp28qij58i1"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
_surfaces = [{
|
||||||
|
"2d": true,
|
||||||
|
"aabb": AABB(-16, -16, 0, 32, 32, 0),
|
||||||
|
"attribute_data": PackedByteArray(0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 128, 63),
|
||||||
|
"format": 34393296913,
|
||||||
|
"index_count": 6,
|
||||||
|
"index_data": PackedByteArray(3, 0, 0, 0, 1, 0, 1, 0, 2, 0, 3, 0),
|
||||||
|
"primitive": 3,
|
||||||
|
"uv_scale": Vector4(0, 0, 0, 0),
|
||||||
|
"vertex_count": 4,
|
||||||
|
"vertex_data": PackedByteArray(0, 0, 128, 193, 0, 0, 128, 65, 0, 0, 128, 193, 0, 0, 128, 193, 0, 0, 128, 65, 0, 0, 128, 193, 0, 0, 128, 65, 0, 0, 128, 65)
|
||||||
|
}]
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
class_name RapierAnimatableBody2D
|
||||||
|
extends AnimatableBody2D
|
||||||
|
|
||||||
|
@export var body_skin: float = 0.0:
|
||||||
|
get:
|
||||||
|
return body_skin
|
||||||
|
set(value):
|
||||||
|
if value != body_skin:
|
||||||
|
body_skin = value
|
||||||
|
set_body_skin(value)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
set_body_skin(body_skin)
|
||||||
|
|
||||||
|
func set_body_skin(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_CONTACT_SKIN, value)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b1u335fltss66
|
||||||
16
addons/godot-rapier2d/custom_nodes/rapier_area_2d.gd
Normal file
16
addons/godot-rapier2d/custom_nodes/rapier_area_2d.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
class_name RapierArea2D
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
@export var body_skin: float = 0.0:
|
||||||
|
get:
|
||||||
|
return body_skin
|
||||||
|
set(value):
|
||||||
|
if value != body_skin:
|
||||||
|
body_skin = value
|
||||||
|
set_body_skin(value)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
set_body_skin(body_skin)
|
||||||
|
|
||||||
|
func set_body_skin(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_CONTACT_SKIN, value)
|
||||||
1
addons/godot-rapier2d/custom_nodes/rapier_area_2d.gd.uid
Normal file
1
addons/godot-rapier2d/custom_nodes/rapier_area_2d.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cburu6b4ckehs
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
class_name RapierCharacterBody2D
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
@export var body_skin: float = 0.0:
|
||||||
|
get:
|
||||||
|
return body_skin
|
||||||
|
set(value):
|
||||||
|
if value != body_skin:
|
||||||
|
body_skin = value
|
||||||
|
set_body_skin(value)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
set_body_skin(body_skin)
|
||||||
|
|
||||||
|
func set_body_skin(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_CONTACT_SKIN, value)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://c5qpdmvd63ugb
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
class_name RapierDampedSpringJoint2D
|
||||||
|
extends DampedSpringJoint2D
|
||||||
|
|
||||||
|
@export_enum("Impulse", "Multibody") var joint_type: int = 0:
|
||||||
|
get:
|
||||||
|
return joint_type
|
||||||
|
set(value):
|
||||||
|
if value != joint_type:
|
||||||
|
joint_type = value
|
||||||
|
set_joint_type(value)
|
||||||
|
|
||||||
|
@export var ik_target: Node2D = null:
|
||||||
|
set(value):
|
||||||
|
ik_target = value
|
||||||
|
|
||||||
|
@export_group("IK Constraints")
|
||||||
|
|
||||||
|
@export var ik_constrain_x: bool = true:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_x = value
|
||||||
|
|
||||||
|
@export var ik_constrain_y: bool = true:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_y = value
|
||||||
|
|
||||||
|
@export var ik_constrain_rotation: bool = false:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_rotation = value
|
||||||
|
|
||||||
|
@export_group("IK Solver Settings")
|
||||||
|
|
||||||
|
@export_range(0.0, 100.0, 0.01) var ik_damping: float = 1.0:
|
||||||
|
set(value):
|
||||||
|
ik_damping = value
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
@export_range(1, 100, 1) var ik_max_iterations: int = 10:
|
||||||
|
set(value):
|
||||||
|
ik_max_iterations = value
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
var _ik_constrained_axes: int = 3
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
set_joint_type(joint_type)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_update_constrained_axes()
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
_solve_ik_for_target()
|
||||||
|
|
||||||
|
func _solve_ik_for_target() -> void:
|
||||||
|
if not is_inside_tree() or ik_target == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
if joint_type != 1 and joint_type != 2:
|
||||||
|
return
|
||||||
|
|
||||||
|
solve_ik(ik_target.global_transform)
|
||||||
|
|
||||||
|
func _update_ik_options() -> void:
|
||||||
|
if not is_inside_tree():
|
||||||
|
return
|
||||||
|
|
||||||
|
var joint_rid := get_rid()
|
||||||
|
if not joint_rid.is_valid():
|
||||||
|
return
|
||||||
|
|
||||||
|
RapierPhysicsServer2D.joint_set_ik_options(
|
||||||
|
joint_rid,
|
||||||
|
ik_damping,
|
||||||
|
ik_max_iterations,
|
||||||
|
_ik_constrained_axes,
|
||||||
|
0.001,
|
||||||
|
0.001,
|
||||||
|
)
|
||||||
|
|
||||||
|
func _update_constrained_axes() -> void:
|
||||||
|
_ik_constrained_axes = 0
|
||||||
|
if ik_constrain_x:
|
||||||
|
_ik_constrained_axes |= 1
|
||||||
|
if ik_constrain_y:
|
||||||
|
_ik_constrained_axes |= 2
|
||||||
|
if ik_constrain_rotation:
|
||||||
|
_ik_constrained_axes |= 4
|
||||||
|
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
|
||||||
|
func set_joint_type(type: int) -> void:
|
||||||
|
RapierPhysicsServer2D.joint_set_extra_param(get_rid(), RapierPhysicsServer2D.JOINT_TYPE, type)
|
||||||
|
|
||||||
|
func solve_ik(target_transform: Transform2D) -> void:
|
||||||
|
if not is_inside_tree():
|
||||||
|
return
|
||||||
|
|
||||||
|
var joint_rid := get_rid()
|
||||||
|
if not joint_rid.is_valid():
|
||||||
|
return
|
||||||
|
|
||||||
|
RapierPhysicsServer2D.joint_solve_inverse_kinematics(joint_rid, target_transform)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cpnkbppqchh48
|
||||||
107
addons/godot-rapier2d/custom_nodes/rapier_groove_joint_2d.gd
Normal file
107
addons/godot-rapier2d/custom_nodes/rapier_groove_joint_2d.gd
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
class_name RapierGrooveJoint2D
|
||||||
|
extends GrooveJoint2D
|
||||||
|
|
||||||
|
@export_enum("Impulse", "Multibody") var joint_type: int = 0:
|
||||||
|
get:
|
||||||
|
return joint_type
|
||||||
|
set(value):
|
||||||
|
if value != joint_type:
|
||||||
|
joint_type = value
|
||||||
|
set_joint_type(value)
|
||||||
|
|
||||||
|
@export var ik_target: Node2D = null:
|
||||||
|
set(value):
|
||||||
|
ik_target = value
|
||||||
|
|
||||||
|
@export_group("IK Constraints")
|
||||||
|
|
||||||
|
@export var ik_constrain_x: bool = true:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_x = value
|
||||||
|
|
||||||
|
@export var ik_constrain_y: bool = true:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_y = value
|
||||||
|
|
||||||
|
@export var ik_constrain_rotation: bool = false:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_rotation = value
|
||||||
|
|
||||||
|
@export_group("IK Solver Settings")
|
||||||
|
|
||||||
|
@export_range(0.0, 100.0, 0.01) var ik_damping: float = 1.0:
|
||||||
|
set(value):
|
||||||
|
ik_damping = value
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
@export_range(1, 100, 1) var ik_max_iterations: int = 10:
|
||||||
|
set(value):
|
||||||
|
ik_max_iterations = value
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
var _ik_constrained_axes: int = 3
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
set_joint_type(joint_type)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_update_constrained_axes()
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
_solve_ik_for_target()
|
||||||
|
|
||||||
|
func _solve_ik_for_target() -> void:
|
||||||
|
if not is_inside_tree() or ik_target == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
if joint_type != 1 and joint_type != 2:
|
||||||
|
return
|
||||||
|
|
||||||
|
solve_ik(ik_target.global_transform)
|
||||||
|
|
||||||
|
func _update_ik_options() -> void:
|
||||||
|
if not is_inside_tree():
|
||||||
|
return
|
||||||
|
|
||||||
|
var joint_rid := get_rid()
|
||||||
|
if not joint_rid.is_valid():
|
||||||
|
return
|
||||||
|
|
||||||
|
RapierPhysicsServer2D.joint_set_ik_options(
|
||||||
|
joint_rid,
|
||||||
|
ik_damping,
|
||||||
|
ik_max_iterations,
|
||||||
|
_ik_constrained_axes,
|
||||||
|
0.001,
|
||||||
|
0.001,
|
||||||
|
)
|
||||||
|
|
||||||
|
func _update_constrained_axes() -> void:
|
||||||
|
_ik_constrained_axes = 0
|
||||||
|
if ik_constrain_x:
|
||||||
|
_ik_constrained_axes |= 1
|
||||||
|
if ik_constrain_y:
|
||||||
|
_ik_constrained_axes |= 2
|
||||||
|
if ik_constrain_rotation:
|
||||||
|
_ik_constrained_axes |= 4
|
||||||
|
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
|
||||||
|
func set_joint_type(type: int) -> void:
|
||||||
|
RapierPhysicsServer2D.joint_set_extra_param(get_rid(), RapierPhysicsServer2D.JOINT_TYPE, type)
|
||||||
|
|
||||||
|
func solve_ik(target_transform: Transform2D) -> void:
|
||||||
|
if not is_inside_tree():
|
||||||
|
return
|
||||||
|
|
||||||
|
var joint_rid := get_rid()
|
||||||
|
if not joint_rid.is_valid():
|
||||||
|
return
|
||||||
|
|
||||||
|
RapierPhysicsServer2D.joint_solve_inverse_kinematics(joint_rid, target_transform)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bcr2ccv5ahren
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
class_name RapierPhysicalBone2D
|
||||||
|
extends PhysicalBone2D
|
||||||
|
|
||||||
|
@export var massless: bool = false:
|
||||||
|
get:
|
||||||
|
return massless
|
||||||
|
set(value):
|
||||||
|
if value != massless:
|
||||||
|
massless = value
|
||||||
|
set_massless(value)
|
||||||
|
|
||||||
|
@export var body_skin: float = 0.0:
|
||||||
|
get:
|
||||||
|
return body_skin
|
||||||
|
set(value):
|
||||||
|
if value != body_skin:
|
||||||
|
body_skin = value
|
||||||
|
set_body_skin(value)
|
||||||
|
|
||||||
|
@export var dominance: int = 0:
|
||||||
|
get:
|
||||||
|
return dominance
|
||||||
|
set(value):
|
||||||
|
if value != dominance:
|
||||||
|
dominance = value
|
||||||
|
set_dominance(value)
|
||||||
|
|
||||||
|
@export var soft_ccd: float = 0.0:
|
||||||
|
get:
|
||||||
|
return soft_ccd
|
||||||
|
set(value):
|
||||||
|
if value != soft_ccd:
|
||||||
|
soft_ccd = value
|
||||||
|
set_soft_ccd(value)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
set_massless(massless)
|
||||||
|
set_body_skin(body_skin)
|
||||||
|
set_dominance(dominance)
|
||||||
|
set_soft_ccd(soft_ccd)
|
||||||
|
|
||||||
|
func set_body_skin(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_CONTACT_SKIN, value)
|
||||||
|
|
||||||
|
func set_dominance(value: int) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_DOMINANCE, value)
|
||||||
|
|
||||||
|
func set_soft_ccd(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_SOFT_CCD, value)
|
||||||
|
|
||||||
|
func set_massless(value: bool) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_MASSLESS, value)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cwl8hvchm21pr
|
||||||
106
addons/godot-rapier2d/custom_nodes/rapier_pin_joint_2d.gd
Normal file
106
addons/godot-rapier2d/custom_nodes/rapier_pin_joint_2d.gd
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
class_name RapierPinJoint2D
|
||||||
|
extends PinJoint2D
|
||||||
|
|
||||||
|
@export_enum("Impulse", "Multibody") var joint_type: int = 0:
|
||||||
|
get:
|
||||||
|
return joint_type
|
||||||
|
set(value):
|
||||||
|
if value != joint_type:
|
||||||
|
joint_type = value
|
||||||
|
set_joint_type(value)
|
||||||
|
|
||||||
|
@export var ik_target: Node2D = null:
|
||||||
|
set(value):
|
||||||
|
ik_target = value
|
||||||
|
|
||||||
|
@export_group("IK Constraints")
|
||||||
|
|
||||||
|
@export var ik_constrain_x: bool = true:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_x = value
|
||||||
|
|
||||||
|
@export var ik_constrain_y: bool = true:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_y = value
|
||||||
|
|
||||||
|
@export var ik_constrain_rotation: bool = false:
|
||||||
|
set(value):
|
||||||
|
ik_constrain_rotation = value
|
||||||
|
|
||||||
|
@export_group("IK Solver Settings")
|
||||||
|
|
||||||
|
@export_range(0.0, 100.0, 0.01) var ik_damping: float = 1.0:
|
||||||
|
set(value):
|
||||||
|
ik_damping = value
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
@export_range(1, 100, 1) var ik_max_iterations: int = 10:
|
||||||
|
set(value):
|
||||||
|
ik_max_iterations = value
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
var _ik_constrained_axes: int = 3
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
set_joint_type(joint_type)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_update_constrained_axes()
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
_solve_ik_for_target()
|
||||||
|
|
||||||
|
func _solve_ik_for_target() -> void:
|
||||||
|
if not is_inside_tree() or ik_target == null:
|
||||||
|
return
|
||||||
|
|
||||||
|
if joint_type != 1 and joint_type != 2:
|
||||||
|
return
|
||||||
|
|
||||||
|
solve_ik(ik_target.global_transform)
|
||||||
|
|
||||||
|
func _update_ik_options() -> void:
|
||||||
|
if not is_inside_tree():
|
||||||
|
return
|
||||||
|
|
||||||
|
var joint_rid := get_rid()
|
||||||
|
if not joint_rid.is_valid():
|
||||||
|
return
|
||||||
|
|
||||||
|
RapierPhysicsServer2D.joint_set_ik_options(
|
||||||
|
joint_rid,
|
||||||
|
ik_damping,
|
||||||
|
ik_max_iterations,
|
||||||
|
_ik_constrained_axes,
|
||||||
|
0.001,
|
||||||
|
0.001,
|
||||||
|
)
|
||||||
|
|
||||||
|
func _update_constrained_axes() -> void:
|
||||||
|
_ik_constrained_axes = 0
|
||||||
|
if ik_constrain_x:
|
||||||
|
_ik_constrained_axes |= 1
|
||||||
|
if ik_constrain_y:
|
||||||
|
_ik_constrained_axes |= 2
|
||||||
|
if ik_constrain_rotation:
|
||||||
|
_ik_constrained_axes |= 4
|
||||||
|
|
||||||
|
if is_inside_tree():
|
||||||
|
_update_ik_options()
|
||||||
|
|
||||||
|
|
||||||
|
func set_joint_type(type: int) -> void:
|
||||||
|
RapierPhysicsServer2D.joint_set_extra_param(get_rid(), RapierPhysicsServer2D.JOINT_TYPE, type)
|
||||||
|
|
||||||
|
func solve_ik(target_transform: Transform2D) -> void:
|
||||||
|
if not is_inside_tree():
|
||||||
|
return
|
||||||
|
|
||||||
|
var joint_rid := get_rid()
|
||||||
|
if not joint_rid.is_valid():
|
||||||
|
return
|
||||||
|
RapierPhysicsServer2D.joint_solve_inverse_kinematics(joint_rid, target_transform)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bv2bc4lt5v7hu
|
||||||
52
addons/godot-rapier2d/custom_nodes/rapier_rigid_body_2d.gd
Normal file
52
addons/godot-rapier2d/custom_nodes/rapier_rigid_body_2d.gd
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
class_name RapierRigidBody2D
|
||||||
|
extends RigidBody2D
|
||||||
|
|
||||||
|
@export var massless: bool = false:
|
||||||
|
get:
|
||||||
|
return massless
|
||||||
|
set(value):
|
||||||
|
if value != massless:
|
||||||
|
massless = value
|
||||||
|
set_massless(value)
|
||||||
|
|
||||||
|
@export var body_skin: float = 0.0:
|
||||||
|
get:
|
||||||
|
return body_skin
|
||||||
|
set(value):
|
||||||
|
if value != body_skin:
|
||||||
|
body_skin = value
|
||||||
|
set_body_skin(value)
|
||||||
|
|
||||||
|
@export var dominance: int = 0:
|
||||||
|
get:
|
||||||
|
return dominance
|
||||||
|
set(value):
|
||||||
|
if value != dominance:
|
||||||
|
dominance = value
|
||||||
|
set_dominance(value)
|
||||||
|
|
||||||
|
@export var soft_ccd: float = 0.0:
|
||||||
|
get:
|
||||||
|
return soft_ccd
|
||||||
|
set(value):
|
||||||
|
if value != soft_ccd:
|
||||||
|
soft_ccd = value
|
||||||
|
set_soft_ccd(value)
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
set_massless(massless)
|
||||||
|
set_body_skin(body_skin)
|
||||||
|
set_dominance(dominance)
|
||||||
|
set_soft_ccd(soft_ccd)
|
||||||
|
|
||||||
|
func set_body_skin(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_CONTACT_SKIN, value)
|
||||||
|
|
||||||
|
func set_dominance(value: int) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_DOMINANCE, value)
|
||||||
|
|
||||||
|
func set_soft_ccd(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_SOFT_CCD, value)
|
||||||
|
|
||||||
|
func set_massless(value: bool) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_MASSLESS, value)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://unwhnooi7g2c
|
||||||
16
addons/godot-rapier2d/custom_nodes/rapier_static_body_2d.gd
Normal file
16
addons/godot-rapier2d/custom_nodes/rapier_static_body_2d.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
class_name RapierStaticBody2D
|
||||||
|
extends StaticBody2D
|
||||||
|
|
||||||
|
@export var body_skin: float = 0.0:
|
||||||
|
get:
|
||||||
|
return body_skin
|
||||||
|
set(value):
|
||||||
|
if value != body_skin:
|
||||||
|
body_skin = value
|
||||||
|
set_body_skin(value)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
set_body_skin(body_skin)
|
||||||
|
|
||||||
|
func set_body_skin(value: float) -> void:
|
||||||
|
RapierPhysicsServer2D.body_set_extra_param(get_rid(), RapierPhysicsServer2D.BODY_PARAM_CONTACT_SKIN, value)
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
uid://busd3yfk5p1mx
|
||||||
27
addons/godot-rapier2d/faucet_2d.gd
Normal file
27
addons/godot-rapier2d/faucet_2d.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
class_name Faucet2D
|
||||||
|
extends Fluid2D
|
||||||
|
|
||||||
|
@export var interval := 0.06
|
||||||
|
@export var max_particles: int = 1000
|
||||||
|
@export var width: int = 4
|
||||||
|
@export var height: int = 2
|
||||||
|
|
||||||
|
var points_new: PackedVector2Array
|
||||||
|
var velocities_new: PackedVector2Array
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
points_new = create_rectangle_points(width, height)
|
||||||
|
velocities_new.resize(points_new.size())
|
||||||
|
var gravity_value = ProjectSettings.get("physics/2d/default_gravity")
|
||||||
|
var gravity_dir = ProjectSettings.get("physics/2d/default_gravity_vector")
|
||||||
|
var dir = global_transform.basis_xform(gravity_dir * gravity_value)
|
||||||
|
velocities_new.fill(dir)
|
||||||
|
get_tree().create_timer(interval).timeout.connect(_on_timer_timeout)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_timer_timeout():
|
||||||
|
get_tree().create_timer(interval).timeout.connect(_on_timer_timeout)
|
||||||
|
if len(points) > max_particles:
|
||||||
|
return
|
||||||
|
add_points_and_velocities(points_new, velocities_new)
|
||||||
1
addons/godot-rapier2d/faucet_2d.gd.uid
Normal file
1
addons/godot-rapier2d/faucet_2d.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://d4kq5akkly15i
|
||||||
10
addons/godot-rapier2d/fluid_2d_circle.gd
Normal file
10
addons/godot-rapier2d/fluid_2d_circle.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
@tool
|
||||||
|
extends Fluid2D
|
||||||
|
|
||||||
|
@export var circle_radius := 10:
|
||||||
|
set(value):
|
||||||
|
if circle_radius != value:
|
||||||
|
circle_radius = value
|
||||||
|
points = create_circle_points(circle_radius)
|
||||||
|
get:
|
||||||
|
return circle_radius
|
||||||
1
addons/godot-rapier2d/fluid_2d_circle.gd.uid
Normal file
1
addons/godot-rapier2d/fluid_2d_circle.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dhvg3d8muf58l
|
||||||
17
addons/godot-rapier2d/fluid_2d_rectangle.gd
Normal file
17
addons/godot-rapier2d/fluid_2d_rectangle.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
@tool
|
||||||
|
extends Fluid2D
|
||||||
|
|
||||||
|
@export var height := 10:
|
||||||
|
set(value):
|
||||||
|
if height != value:
|
||||||
|
height = value
|
||||||
|
points = create_rectangle_points(width, height)
|
||||||
|
get:
|
||||||
|
return height
|
||||||
|
@export var width := 10:
|
||||||
|
set(value):
|
||||||
|
if width != value:
|
||||||
|
width = value
|
||||||
|
points = create_rectangle_points(width, height)
|
||||||
|
get:
|
||||||
|
return width
|
||||||
1
addons/godot-rapier2d/fluid_2d_rectangle.gd.uid
Normal file
1
addons/godot-rapier2d/fluid_2d_rectangle.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dw26ibcyam23p
|
||||||
31
addons/godot-rapier2d/fluid_2d_renderer.gd
Normal file
31
addons/godot-rapier2d/fluid_2d_renderer.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
@tool
|
||||||
|
class_name Fluid2DRenderer
|
||||||
|
extends MultiMeshInstance2D
|
||||||
|
|
||||||
|
@export var fluid: Fluid2D
|
||||||
|
@export var color: Color = Color(0.8, 0.8, 0.8, 0.3)
|
||||||
|
@export var mesh_scale: Vector2 = Vector2(5, 5)
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if multimesh == null:
|
||||||
|
multimesh = MultiMesh.new()
|
||||||
|
multimesh.mesh = load("res://addons/godot-rapier2d/circle_mesh.tres").duplicate()
|
||||||
|
multimesh.use_colors = true
|
||||||
|
if texture == null:
|
||||||
|
texture = load("res://addons/godot-rapier2d/Radial2D.svg")
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
if fluid == null:
|
||||||
|
return
|
||||||
|
global_transform = fluid.global_transform
|
||||||
|
var index = 0
|
||||||
|
multimesh.instance_count = fluid.points.size()
|
||||||
|
var points = fluid.points
|
||||||
|
for i in points.size():
|
||||||
|
var point = points[i]
|
||||||
|
var new_transform: Transform2D = Transform2D(0, mesh_scale, 0, point)
|
||||||
|
multimesh.set_instance_transform_2d(index, new_transform)
|
||||||
|
multimesh.set_instance_color(index, color)
|
||||||
|
index += 1
|
||||||
1
addons/godot-rapier2d/fluid_2d_renderer.gd.uid
Normal file
1
addons/godot-rapier2d/fluid_2d_renderer.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://c70amrnbdymwf
|
||||||
87
addons/godot-rapier2d/fluid_2d_shader_renderer.gd
Normal file
87
addons/godot-rapier2d/fluid_2d_shader_renderer.gd
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
@tool
|
||||||
|
class_name Fluid2DShaderRenderer
|
||||||
|
extends CanvasLayer
|
||||||
|
|
||||||
|
@export var fluid: Fluid2D:
|
||||||
|
set(value):
|
||||||
|
fluid = value
|
||||||
|
update_configuration_warnings()
|
||||||
|
@export var camera: Camera2D
|
||||||
|
@export var water_material: Material = load("res://addons/godot-rapier2d/water_shader.tres")
|
||||||
|
@export var mesh_scale: Vector2 = Vector2(5, 5)
|
||||||
|
var fluid_renderer: Fluid2DRenderer
|
||||||
|
var inside_camera: Camera2D:
|
||||||
|
set(value):
|
||||||
|
inside_camera = value
|
||||||
|
update_configuration_warnings()
|
||||||
|
var sub_viewport_container: SubViewportContainer
|
||||||
|
var sub_viewport: SubViewport
|
||||||
|
|
||||||
|
|
||||||
|
func _get_configuration_warnings():
|
||||||
|
var warnings = []
|
||||||
|
if camera == null:
|
||||||
|
warnings += ["Camera property is empty."]
|
||||||
|
if fluid == null:
|
||||||
|
warnings += ["Fluid property is empty."]
|
||||||
|
return warnings
|
||||||
|
|
||||||
|
|
||||||
|
func _create_subviewport_container():
|
||||||
|
sub_viewport_container = SubViewportContainer.new()
|
||||||
|
sub_viewport_container.name = "SubViewportContainer"
|
||||||
|
add_child(sub_viewport_container)
|
||||||
|
sub_viewport_container.material = water_material
|
||||||
|
sub_viewport_container.size = Vector2(
|
||||||
|
ProjectSettings.get("display/window/size/viewport_width"),
|
||||||
|
ProjectSettings.get("display/window/size/viewport_height")
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func _create_subviewport():
|
||||||
|
sub_viewport = SubViewport.new()
|
||||||
|
sub_viewport.name = "SubViewport"
|
||||||
|
sub_viewport_container.add_child(sub_viewport)
|
||||||
|
sub_viewport.transparent_bg = true
|
||||||
|
sub_viewport.size = sub_viewport_container.size
|
||||||
|
|
||||||
|
|
||||||
|
func _create_fluid_renderer():
|
||||||
|
fluid_renderer = Fluid2DRenderer.new()
|
||||||
|
fluid_renderer.name = "Fluid2DRenderer"
|
||||||
|
fluid_renderer.color = Color(255, 0, 255)
|
||||||
|
fluid_renderer.mesh_scale = mesh_scale
|
||||||
|
fluid_renderer.fluid = fluid
|
||||||
|
sub_viewport.add_child(fluid_renderer)
|
||||||
|
|
||||||
|
|
||||||
|
func _create_inside_camera():
|
||||||
|
inside_camera = Camera2D.new()
|
||||||
|
inside_camera.name = "Camera2D"
|
||||||
|
inside_camera.material = water_material
|
||||||
|
sub_viewport.add_child(inside_camera)
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_create_subviewport_container()
|
||||||
|
_create_subviewport()
|
||||||
|
_create_fluid_renderer()
|
||||||
|
_create_inside_camera()
|
||||||
|
if fluid:
|
||||||
|
fluid.debug_draw = false
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
if camera != null:
|
||||||
|
inside_camera.offset = camera.offset
|
||||||
|
inside_camera.zoom = camera.zoom
|
||||||
|
inside_camera.transform = camera.transform
|
||||||
|
sub_viewport_container.scale = Vector2(1.0 / camera.zoom.x, 1.0 / camera.zoom.y)
|
||||||
|
sub_viewport_container.position = camera.global_position
|
||||||
|
sub_viewport.size = sub_viewport_container.size
|
||||||
|
if camera.anchor_mode == Camera2D.AnchorMode.ANCHOR_MODE_FIXED_TOP_LEFT:
|
||||||
|
sub_viewport_container.position -= sub_viewport_container.size / 2
|
||||||
|
if !camera.ignore_rotation:
|
||||||
|
sub_viewport_container.rotation = camera.global_rotation
|
||||||
|
else:
|
||||||
|
sub_viewport_container.rotation = 0
|
||||||
1
addons/godot-rapier2d/fluid_2d_shader_renderer.gd.uid
Normal file
1
addons/godot-rapier2d/fluid_2d_shader_renderer.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://qo8bibm1ntwf
|
||||||
44
addons/godot-rapier2d/godot-rapier2d.gdextension
Normal file
44
addons/godot-rapier2d/godot-rapier2d.gdextension
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
[configuration]
|
||||||
|
|
||||||
|
entry_symbol = "rapier_2d_init"
|
||||||
|
compatibility_minimum = 4.3
|
||||||
|
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
|
||||||
|
macos.debug = "bin/libgodot_rapier.macos.framework"
|
||||||
|
macos.release = "bin/libgodot_rapier.macos.framework"
|
||||||
|
windows.debug.x86_64 = "bin/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll"
|
||||||
|
windows.release.x86_64 = "bin/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll"
|
||||||
|
windows.debug.x86_32 = "bin/libgodot_rapier.windows.i686-pc-windows-msvc.dll"
|
||||||
|
windows.release.x86_32 = "bin/libgodot_rapier.windows.i686-pc-windows-msvc.dll"
|
||||||
|
windows.debug.arm64 = "bin/libgodot_rapier.windows.aarch64-pc-windows-msvc.dll"
|
||||||
|
windows.release.arm64 = "bin/libgodot_rapier.windows.aarch64-pc-windows-msvc.dll"
|
||||||
|
linux.debug.x86_64 = "bin/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so"
|
||||||
|
linux.release.x86_64 = "bin/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so"
|
||||||
|
linux.debug.x86_32 = "bin/libgodot_rapier.linux.i686-unknown-linux-gnu.so"
|
||||||
|
linux.release.x86_32 = "bin/libgodot_rapier.linux.i686-unknown-linux-gnu.so"
|
||||||
|
linux.debug.arm64 = "bin/libgodot_rapier.linux.aarch64-unknown-linux-gnu.so"
|
||||||
|
linux.release.arm64 = "bin/libgodot_rapier.linux.aarch64-unknown-linux-gnu.so"
|
||||||
|
linux.debug.arm32 = "bin/libgodot_rapier.linux.armv7-unknown-linux-gnueabihf.so"
|
||||||
|
linux.release.arm32 = "bin/libgodot_rapier.linux.armv7-unknown-linux-gnueabihf.so"
|
||||||
|
android.debug.x86_64 = "bin/libgodot_rapier.android.x86_64-linux-android.so"
|
||||||
|
android.release.x86_64 = "bin/libgodot_rapier.android.x86_64-linux-android.so"
|
||||||
|
android.debug.x86_32 = "bin/libgodot_rapier.android.i686-linux-android.so"
|
||||||
|
android.release.x86_32 = "bin/libgodot_rapier.android.i686-linux-android.so"
|
||||||
|
android.debug.arm64 = "bin/libgodot_rapier.android.aarch64-linux-android.so"
|
||||||
|
android.release.arm64 = "bin/libgodot_rapier.android.aarch64-linux-android.so"
|
||||||
|
android.debug.arm32 = "bin/libgodot_rapier.android.armv7-linux-androideabi.so"
|
||||||
|
android.release.arm32 = "bin/libgodot_rapier.android.armv7-linux-androideabi.so"
|
||||||
|
ios.debug.arm64 = "bin/libgodot_rapier.ios.arm64.framework"
|
||||||
|
ios.release.arm64 = "bin/libgodot_rapier.ios.arm64.framework"
|
||||||
|
ios.debug.x86_64 = "bin/libgodot_rapier.ios.x86_64.framework"
|
||||||
|
ios.release.x86_64 = "bin/libgodot_rapier.ios.x86_64.framework"
|
||||||
|
web.debug.threads.wasm32 = "bin/godot_rapier.wasm"
|
||||||
|
web.release.threads.wasm32 = "bin/godot_rapier.wasm"
|
||||||
|
web.debug.wasm32 = "bin/wasm-nothreads/godot_rapier.wasm"
|
||||||
|
web.release.wasm32 = "bin/wasm-nothreads/godot_rapier.wasm"
|
||||||
|
|
||||||
|
[icons]
|
||||||
|
|
||||||
|
Fluid2D = "Fluid2D.svg"
|
||||||
1
addons/godot-rapier2d/godot-rapier2d.gdextension.uid
Normal file
1
addons/godot-rapier2d/godot-rapier2d.gdextension.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cydvir118dli4
|
||||||
BIN
addons/godot-rapier2d/logo_square_2d.png
Normal file
BIN
addons/godot-rapier2d/logo_square_2d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
40
addons/godot-rapier2d/logo_square_2d.png.import
Normal file
40
addons/godot-rapier2d/logo_square_2d.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://d1iwpd5epp8u6"
|
||||||
|
path="res://.godot/imported/logo_square_2d.png-ee7cb55fd9c4d1815ce7e83cd5401198.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/godot-rapier2d/logo_square_2d.png"
|
||||||
|
dest_files=["res://.godot/imported/logo_square_2d.png-ee7cb55fd9c4d1815ce7e83cd5401198.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
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
|
||||||
8
addons/godot-rapier2d/plugin.info.cfg
Normal file
8
addons/godot-rapier2d/plugin.info.cfg
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
[plugin]
|
||||||
|
|
||||||
|
name="Godot Rapier 2D"
|
||||||
|
description="A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids."
|
||||||
|
author="appsinacup"
|
||||||
|
version="0.8.24"
|
||||||
|
flavour="godot-rapier-2d-single-simd-parallel"
|
||||||
|
script=""
|
||||||
108
addons/godot-rapier2d/rapier_state_2d.gd
Normal file
108
addons/godot-rapier2d/rapier_state_2d.gd
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
### Supports [CollisionObject2D], [Joint2D] and [CollisionShape2D].
|
||||||
|
@icon("res://addons/godot-rapier2d/logo_square_2d.png")
|
||||||
|
class_name Rapier2DState
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var state: Dictionary = {}
|
||||||
|
|
||||||
|
|
||||||
|
func _is_physics_object(node: Node) -> bool:
|
||||||
|
return node is CollisionObject2D or node is Joint2D
|
||||||
|
|
||||||
|
|
||||||
|
func _get_all_physics_nodes(p_node: Node, path: String = "/root/") -> Array[String]:
|
||||||
|
var results: Array[String] = []
|
||||||
|
if path == "/root/" && _is_physics_object(p_node):
|
||||||
|
results.append(path + p_node.name)
|
||||||
|
path += p_node.name + "/"
|
||||||
|
for node in p_node.get_children():
|
||||||
|
if _is_physics_object(node):
|
||||||
|
results.append(path + node.name)
|
||||||
|
if node.get_child_count() > 0:
|
||||||
|
results.append_array(_get_all_physics_nodes(node, path))
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
## Save a node's physics state
|
||||||
|
func save_node(rid: RID, save_json: bool):
|
||||||
|
if save_json:
|
||||||
|
return JSON.parse_string(RapierPhysicsServer2D.export_json(rid))
|
||||||
|
return RapierPhysicsServer2D.export_binary(rid)
|
||||||
|
|
||||||
|
|
||||||
|
## Load a node's physics state
|
||||||
|
func load_node(rid: RID, data: PackedByteArray):
|
||||||
|
RapierPhysicsServer2D.import_binary(rid, data)
|
||||||
|
|
||||||
|
|
||||||
|
## Save the state of whole world (single space)
|
||||||
|
func save_state(save_json: bool = false) -> int:
|
||||||
|
var physics_nodes := _get_all_physics_nodes(get_tree().current_scene)
|
||||||
|
for node_path in physics_nodes:
|
||||||
|
var node := get_node(node_path)
|
||||||
|
var rid: RID
|
||||||
|
if node is CollisionObject2D:
|
||||||
|
rid = node.get_rid()
|
||||||
|
for owner_id in node.get_shape_owners():
|
||||||
|
for owner_shape_id in node.shape_owner_get_shape_count(owner_id):
|
||||||
|
var shape_rid = node.shape_owner_get_shape(owner_id, owner_shape_id).get_rid()
|
||||||
|
state[node_path + "/" + str(owner_id) + "/" + str(owner_shape_id)] = save_node(
|
||||||
|
shape_rid, save_json
|
||||||
|
)
|
||||||
|
if node is Joint2D:
|
||||||
|
rid = node.get_rid()
|
||||||
|
state[node_path] = save_node(rid, save_json)
|
||||||
|
var space_rid = get_viewport().world_2d.space
|
||||||
|
state["space"] = save_node(space_rid, save_json)
|
||||||
|
state["id"] = RapierPhysicsServer2D.get_global_id()
|
||||||
|
return hash(JSON.stringify(state, " "))
|
||||||
|
|
||||||
|
|
||||||
|
## Load the state of whole world (single space)
|
||||||
|
func load_state() -> int:
|
||||||
|
var physics_nodes := _get_all_physics_nodes(get_tree().current_scene)
|
||||||
|
for node_path in physics_nodes:
|
||||||
|
var node := get_node(node_path)
|
||||||
|
var rid: RID
|
||||||
|
if node is CollisionObject2D:
|
||||||
|
rid = node.get_rid()
|
||||||
|
for owner_id in node.get_shape_owners():
|
||||||
|
for owner_shape_id in node.shape_owner_get_shape_count(owner_id):
|
||||||
|
var shape_rid = node.shape_owner_get_shape(owner_id, owner_shape_id).get_rid()
|
||||||
|
var shape_state = state[
|
||||||
|
node_path + "/" + str(owner_id) + "/" + str(owner_shape_id)
|
||||||
|
]
|
||||||
|
load_node(shape_rid, JSON.parse_string(shape_state))
|
||||||
|
if node is Joint2D:
|
||||||
|
rid = node.get_rid()
|
||||||
|
var node_state = state[node_path]
|
||||||
|
load_node(rid, JSON.parse_string(node_state))
|
||||||
|
var space_rid = get_viewport().world_2d.space
|
||||||
|
load_node(space_rid, JSON.parse_string(state["space"]))
|
||||||
|
RapierPhysicsServer2D.set_global_id(int(state["id"]))
|
||||||
|
RapierPhysicsServer2D.space_flush_queries(space_rid)
|
||||||
|
return hash(JSON.stringify(state, " "))
|
||||||
|
|
||||||
|
|
||||||
|
## Export the state to file
|
||||||
|
func export_state(file_name: String = "user://state.json"):
|
||||||
|
var hash = save_state(false)
|
||||||
|
FileAccess.open(file_name, FileAccess.WRITE).store_string(JSON.stringify(state, " "))
|
||||||
|
return hash
|
||||||
|
|
||||||
|
|
||||||
|
## Import the state from file
|
||||||
|
func import_state(file_name: String = "user://state.json"):
|
||||||
|
state = JSON.parse_string(FileAccess.open(file_name, FileAccess.READ).get_as_text())
|
||||||
|
return load_state()
|
||||||
|
|
||||||
|
|
||||||
|
#func _notification(what: int) -> void:
|
||||||
|
#if what == NOTIFICATION_ENTER_TREE:
|
||||||
|
#print("enter tree")
|
||||||
|
# TODO reload state here?
|
||||||
|
#if what == NOTIFICATION_EXIT_TREE:
|
||||||
|
# save_state(false)
|
||||||
|
# FileAccess.open("user://save.json", FileAccess.WRITE).store_string(
|
||||||
|
# JSON.stringify(state, " ")
|
||||||
|
# )
|
||||||
1
addons/godot-rapier2d/rapier_state_2d.gd.uid
Normal file
1
addons/godot-rapier2d/rapier_state_2d.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b4u71ckduv8gr
|
||||||
22
addons/godot-rapier2d/water_shader.gdshader
Normal file
22
addons/godot-rapier2d/water_shader.gdshader
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform float threshold = 0.8;
|
||||||
|
uniform vec4 water_color: source_color = vec4(0.12,0.24,0.45,0.65);
|
||||||
|
uniform vec4 test_color: source_color = vec4(1,0,1,1);
|
||||||
|
|
||||||
|
uniform float speed = 0.1; // Speed of movement
|
||||||
|
uniform float amplitude = 0.1; // Amplitude of movement
|
||||||
|
|
||||||
|
uniform sampler2D water_texture;
|
||||||
|
|
||||||
|
void fragment(){
|
||||||
|
float displacement = sin(TIME * speed) * amplitude;
|
||||||
|
vec4 screen_tex = texture(TEXTURE, SCREEN_UV).rgba;
|
||||||
|
|
||||||
|
float color_distance = screen_tex.r;
|
||||||
|
if (color_distance > threshold) {
|
||||||
|
COLOR = texture(water_texture, SCREEN_UV + displacement).rgba * water_color;
|
||||||
|
} else {
|
||||||
|
COLOR = vec4(0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
addons/godot-rapier2d/water_shader.gdshader.uid
Normal file
1
addons/godot-rapier2d/water_shader.gdshader.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cgysptptloown
|
||||||
11
addons/godot-rapier2d/water_shader.tres
Normal file
11
addons/godot-rapier2d/water_shader.tres
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://cysnk7s2ll173"]
|
||||||
|
|
||||||
|
[ext_resource type="Shader" path="res://addons/godot-rapier2d/water_shader.gdshader" id="1_wgm3x"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
shader = ExtResource("1_wgm3x")
|
||||||
|
shader_parameter/threshold = 0.8
|
||||||
|
shader_parameter/water_color = Color(0.12, 0.24, 0.45, 0.65)
|
||||||
|
shader_parameter/test_color = Color(1, 0, 1, 1)
|
||||||
|
shader_parameter/speed = 0.1
|
||||||
|
shader_parameter/amplitude = 0.1
|
||||||
11
follower_click.gd
Normal file
11
follower_click.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
extends Marker2D
|
||||||
|
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
position = get_global_mouse_position()
|
||||||
1
follower_click.gd.uid
Normal file
1
follower_click.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://c5cyiafgmvb8h
|
||||||
11
marker_2d.gd
Normal file
11
marker_2d.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
extends Marker2D
|
||||||
|
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
global_position = get_global_mouse_position()
|
||||||
1
marker_2d.gd.uid
Normal file
1
marker_2d.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://c53qchbhmig8
|
||||||
|
|
@ -11,9 +11,82 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Super Space Game"
|
config/name="Super Space Game"
|
||||||
|
run/main_scene="uid://bauklhpieuivd"
|
||||||
config/features=PackedStringArray("4.5", "Mobile")
|
config/features=PackedStringArray("4.5", "Mobile")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/viewport_width=1600
|
||||||
|
window/size/viewport_height=900
|
||||||
|
window/stretch/scale_mode="integer"
|
||||||
|
|
||||||
|
[editor_plugins]
|
||||||
|
|
||||||
|
enabled=PackedStringArray("res://addons/godot_super-wakatime/plugin.cfg")
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
turn_left={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
turn_right={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
forward={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
backward={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
fire={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(588, 29),"global_position":Vector2(597, 77),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
secondary_fire={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":2,"position":Vector2(503, 1),"global_position":Vector2(512, 49),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
switch_weapons={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
dash={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":8,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
[physics]
|
||||||
|
|
||||||
|
2d/physics_engine="Rapier2D"
|
||||||
|
2d/default_gravity=0.0
|
||||||
|
2d/default_gravity_vector=Vector2(0, 0)
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
textures/canvas_textures/default_texture_filter=0
|
||||||
renderer/rendering_method="mobile"
|
renderer/rendering_method="mobile"
|
||||||
|
2d/snap/snap_2d_transforms_to_pixel=true
|
||||||
|
|
|
||||||
28
scenes/game.tscn
Normal file
28
scenes/game.tscn
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://bauklhpieuivd"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dtwo7g0ipc4k" path="res://textures/ship_1.png" id="1_uwrxv"]
|
||||||
|
[ext_resource type="Script" uid="uid://bfxfkrkaebxk0" path="res://scripts/player.gd" id="1_yqjtg"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_uwrxv"]
|
||||||
|
radius = 16.0
|
||||||
|
|
||||||
|
[node name="Game" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="Player" type="RigidBody2D" parent="."]
|
||||||
|
linear_damp = 6.247
|
||||||
|
script = ExtResource("1_yqjtg")
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite2D" parent="Player"]
|
||||||
|
texture = ExtResource("1_uwrxv")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Player"]
|
||||||
|
shape = SubResource("CircleShape2D_uwrxv")
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="Player"]
|
||||||
|
ignore_rotation = false
|
||||||
|
position_smoothing_enabled = true
|
||||||
|
position_smoothing_speed = 8.0
|
||||||
|
rotation_smoothing_enabled = true
|
||||||
|
rotation_smoothing_speed = 15.0
|
||||||
|
|
||||||
|
[node name="RigidBody2D" type="RigidBody2D" parent="."]
|
||||||
13
scripts/player.gd
Normal file
13
scripts/player.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
extends RigidBody2D
|
||||||
|
|
||||||
|
var health = 1000
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
var axis = Input.get_axis("turn_left", "turn_right")
|
||||||
|
|
||||||
|
angular_velocity = deg_to_rad(180 * axis)
|
||||||
|
|
||||||
|
var new_velocity = transform.y * Input.get_axis("forward", "backward") * 512
|
||||||
|
|
||||||
|
if new_velocity.length() > linear_velocity.length() - 12:
|
||||||
|
linear_velocity = transform.y * Input.get_axis("forward", "backward") * 512
|
||||||
1
scripts/player.gd.uid
Normal file
1
scripts/player.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bfxfkrkaebxk0
|
||||||
39
test_fluid.tscn
Normal file
39
test_fluid.tscn
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://cmp1bhx77d1j5"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://d4kq5akkly15i" path="res://addons/godot-rapier2d/faucet_2d.gd" id="1_dv1o8"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_lv57a"]
|
||||||
|
size = Vector2(404, 20)
|
||||||
|
|
||||||
|
[sub_resource type="FluidEffect2DSurfaceTensionAKINCI" id="FluidEffect2DSurfaceTensionAKINCI_dv1o8"]
|
||||||
|
fluid_tension_coefficient = 100.0
|
||||||
|
|
||||||
|
[node name="TestFluid" type="Node2D"]
|
||||||
|
|
||||||
|
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
||||||
|
position = Vector2(591, 545)
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
|
position = Vector2(29, 0)
|
||||||
|
shape = SubResource("RectangleShape2D_lv57a")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
|
position = Vector2(-191, -134)
|
||||||
|
rotation = 1.2401063
|
||||||
|
shape = SubResource("RectangleShape2D_lv57a")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="StaticBody2D"]
|
||||||
|
position = Vector2(258, -172)
|
||||||
|
rotation = -1.3760309
|
||||||
|
shape = SubResource("RectangleShape2D_lv57a")
|
||||||
|
|
||||||
|
[node name="Fluid2D" type="Fluid2D" parent="."]
|
||||||
|
debug_draw = true
|
||||||
|
density = 1000.0
|
||||||
|
effects = Array[Resource]([SubResource("FluidEffect2DSurfaceTensionAKINCI_dv1o8")])
|
||||||
|
position = Vector2(653, -76)
|
||||||
|
script = ExtResource("1_dv1o8")
|
||||||
|
interval = 0.1
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
position = Vector2(591, 323)
|
||||||
BIN
textures/asteroid_small.ase
Normal file
BIN
textures/asteroid_small.ase
Normal file
Binary file not shown.
BIN
textures/asteroid_small.png
Normal file
BIN
textures/asteroid_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 237 B |
40
textures/asteroid_small.png.import
Normal file
40
textures/asteroid_small.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://co67k1hqadpv4"
|
||||||
|
path="res://.godot/imported/asteroid_small.png-5e81a009ce26e10fcb7476ff148bf394.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://textures/asteroid_small.png"
|
||||||
|
dest_files=["res://.godot/imported/asteroid_small.png-5e81a009ce26e10fcb7476ff148bf394.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
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
|
||||||
BIN
textures/ship_1.ase
Normal file
BIN
textures/ship_1.ase
Normal file
Binary file not shown.
BIN
textures/ship_1.png
Normal file
BIN
textures/ship_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 233 B |
40
textures/ship_1.png.import
Normal file
40
textures/ship_1.png.import
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dtwo7g0ipc4k"
|
||||||
|
path="res://.godot/imported/ship_1.png-32c39a17cb3dc6e2b04dc13f8efb26c2.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://textures/ship_1.png"
|
||||||
|
dest_files=["res://.godot/imported/ship_1.png-32c39a17cb3dc6e2b04dc13f8efb26c2.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
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
|
||||||
Loading…
Reference in a new issue