Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit51da062

Browse files
committed
add easy_ext for more concise ext-traits
1 parent73351a3 commit51da062

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

‎Cargo.lock‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ winit = { version = "^0.30", default-features = false }
124124
# Remove these features if you want to profile your game with tracy.
125125
# (see <https://github.com/bevyengine/bevy/blob/main/docs/profiling.md#tracy-profiler>)
126126
tracing = {version ="^0.1",features = ["max_level_debug","release_max_level_warn"] }
127+
easy-ext ="1.0.2"
127128

128129
[target.wasm32-unknown-unknown.dependencies]
129130
firewheel-web-audio = {git ="https://github.com/CorvusPrudens/firewheel-web-audio",rev ="65888f3" }

‎src/models/ext_traits.rs‎

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
usesuper::*;
22
use avian3d::prelude::*;
33
use bevy::gltf::GltfMesh;
4+
use easy_ext::ext;
45

56
/// Helper trait to spawn mesh with minimum effort
67
///
@@ -25,19 +26,9 @@ use bevy::gltf::GltfMesh;
2526
/// );
2627
/// }
2728
/// ```
28-
#[allow(dead_code)]
29-
pubtraitSpawnCollidingMesh{
30-
fnspawn_colliding_mesh(
31-
&mutself,
32-
gltf:&Gltf,
33-
meshes:&ResMut<Assets<Mesh>>,
34-
gltf_meshes:&Res<Assets<GltfMesh>>,
35-
bundle:implBundle +Clone,
36-
);
37-
}
38-
39-
implSpawnCollidingMeshforCommands<'_,'_>{
40-
fnspawn_colliding_mesh(
29+
#[ext(SpawnCollidingMesh)]
30+
implCommands<'_,'_>{
31+
pubfnspawn_colliding_mesh(
4132
&mutself,
4233
gltf:&Gltf,
4334
meshes:&ResMut<Assets<Mesh>>,
@@ -68,12 +59,9 @@ impl SpawnCollidingMesh for Commands<'_, '_> {
6859
}
6960

7061
/// Helper trait to get direction of movement based on camera transform
71-
pubtraitMovementDirection{
72-
fnmovement_direction(&self,input:Vec2) ->Vec3;
73-
}
74-
75-
implMovementDirectionforTransform{
76-
fnmovement_direction(&self,input:Vec2) ->Vec3{
62+
#[ext(MovementDirection)]
63+
implTransform{
64+
pubfnmovement_direction(&self,input:Vec2) ->Vec3{
7765
let forward =self.forward();
7866
let forward_flat =Vec3::new(forward.x,0.0, forward.z);
7967
let right = forward_flat.cross(Vec3::Y).normalize();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp