feat: add default properties for 2d and 3d

This commit is contained in:
dusk 2024-12-06 22:29:26 +03:00
parent e82751e2bf
commit 99c1248d9c
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
7 changed files with 29 additions and 10 deletions

View File

@ -7,7 +7,7 @@ addon for Godot that adds 2D / 3D boids (flocking).
it can handle about 2000 boids in a single flock at 11ms physics process tick on my PC (Ryzen 5600).
(keep in mind this is without any partitioning of sorts, so it's bound to get better)
## usage
## install
download it from the [asset library](https://godotengine.org/asset-library/asset/3284).
@ -16,6 +16,11 @@ or clone the repository, and run `just all` to build the libraries (in release m
currently, linux, windows and web (wasm) is supported.
## usage
take a look at the [examples](./examples/boids/).
the addon folder also contains [a set of default properties extracted from the examples](./addons/boids/defaults/).
## development
it's just a standard rust project under `rust`, so make sure you have `rustup` installed (or the toolchain specified under `rust-toolchain.toml`.)

View File

@ -0,0 +1,5 @@
[gd_resource type="BoidProperties" format=3 uid="uid://be12p6dxpuvg5"]
[resource]
alignment = 1.0
cohesion = 0.8

View File

@ -0,0 +1,3 @@
[gd_resource type="FlockProperties" format=3 uid="uid://6iwscl4up3tg"]
[resource]

View File

@ -0,0 +1,5 @@
[gd_resource type="BoidProperties" format=3 uid="uid://bnlws4wqnydj0"]
[resource]
max_speed = 0.2
max_force = 0.04

View File

@ -0,0 +1,6 @@
[gd_resource type="FlockProperties" format=3 uid="uid://cr1ysckawaeow"]
[resource]
goal_seperation = 4.0
goal_alignment = 16.0
goal_cohesion = 16.0

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://op0qicvpbjt6"]
[ext_resource type="Script" path="res://examples/boids/2d/simple/example.gd" id="1_3gcrf"]
[ext_resource type="FlockProperties" uid="uid://6iwscl4up3tg" path="res://addons/boids/defaults/2d_flock_properties.tres" id="2_2xgek"]
[sub_resource type="Environment" id="Environment_jxsqf"]
background_mode = 3
@ -8,8 +9,6 @@ glow_enabled = true
glow_bloom = 0.2
glow_blend_mode = 1
[sub_resource type="FlockProperties" id="FlockProperties_cvyp0"]
[node name="Example" type="Node2D"]
script = ExtResource("1_3gcrf")
@ -17,7 +16,7 @@ script = ExtResource("1_3gcrf")
environment = SubResource("Environment_jxsqf")
[node name="Flock" type="Flock2D" parent="."]
properties = SubResource("FlockProperties_cvyp0")
properties = ExtResource("2_2xgek")
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(576, 324)

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://dmjob0jc7a2qr"]
[ext_resource type="Script" path="res://examples/boids/3d/simple/example.gd" id="1_um23s"]
[ext_resource type="FlockProperties" uid="uid://cr1ysckawaeow" path="res://addons/boids/defaults/3d_flock_properties.tres" id="2_fviqq"]
[sub_resource type="Environment" id="Environment_aypca"]
ambient_light_source = 2
@ -9,11 +10,6 @@ glow_enabled = true
glow_bloom = 0.1
glow_blend_mode = 1
[sub_resource type="FlockProperties" id="FlockProperties_1d3ec"]
goal_seperation = 4.0
goal_alignment = 16.0
goal_cohesion = 16.0
[node name="Example" type="Node3D"]
script = ExtResource("1_um23s")
@ -21,7 +17,7 @@ script = ExtResource("1_um23s")
environment = SubResource("Environment_aypca")
[node name="Flock3D" type="Flock3D" parent="." node_paths=PackedStringArray("target")]
properties = SubResource("FlockProperties_1d3ec")
properties = ExtResource("2_fviqq")
target = NodePath("../Marker3D")
[node name="Camera3D" type="Camera3D" parent="."]