208 questions
0
votes
0
answers
23
views
How can I get global input in bevy?
I am trying to make a music player with Bevy and Rust. I want to use global input to check if the play/pause button has been pressed even when the window is not in focus.
I've tried using a number of ...
0
votes
0
answers
13
views
bevy_rapier external impulse sometimes doesn't work
I'm writing a simple 2d game in Bevy, using bevy_rapier (This problem occurs under Bevy 0.14 and 0.15, with bevy_rapier 0.27 and 0.28). In my game, the player receives a bounce after hitting the ...
0
votes
0
answers
18
views
KinematicCharacterController.Translation not moving object
use bevy::prelude::*;
use bevy_rapier2d::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100....
0
votes
1
answer
81
views
Why doesn't rapier3d collision detection work in bevy engine?
I am developing a game using bevy 0.14. I am slowly progressing through the manual. I tried to detect collisions using rapier3d.
Since there is no response, I want to check if the settings are ...
0
votes
1
answer
82
views
How to switch Bevy engine from f32 to f64 type?
I want to switch the type for translation across all components of my project. I know there are special f64-based types, but how to enable them for the entire engine? For example for the Transform ...
1
vote
0
answers
27
views
How to orientate the transform of a segment from a starting and ending point in bevy
I am trying to represent the segment of a cube, however i fail to create a way to orientate segments depending on their starting position and ending position.
What I've come up so far is to get the ...
0
votes
0
answers
74
views
Bevy instance example causes instance position to be inherited when new pbr entity is introduced
I'm running the bevy webgpu shader-instancing example with only the following addition:
commands.spawn(PbrBundle {
mesh: meshes.add(Sphere::new(0.2727).mesh().uv(10, 10)),
material: materials....
0
votes
0
answers
121
views
Players can't accept network messaging session
I have been working on a p2p game using the bevy engine and the steamworks-rs bindings.
Connecting to the steam servers and joining lobbies works just fine, but I can't seem to get networked messages ...
0
votes
0
answers
79
views
Audio_bevy: bevy doesn't replay audio after it finishes (Bevy 0.14.1)
I'm using bevy 0.14.1 to create a small game and I have some problems with the audio. In my game, there is a character that takes coin. Each time an user takes a coin, a sound must be played. I ...
1
vote
1
answer
77
views
Is using a function to manipulate a Cell<T> a code smell in Rust?
I've spent some time developing a new project in rust.
I have a problem understanding whether I am using a Cell in the right way.
This is my current problem, generalized.
I need access to a struct ...
0
votes
0
answers
107
views
How can I use lifetime annotations to avoid these clone()?
I'm working on a clone of Flappy Bird.
I'm using Macroquad.rs and Bevy ECS.
However, I've been using a lot of cloning operations when handling textures for the bird and barriers.
I tried simply adding ...
0
votes
1
answer
232
views
I query an optional component mutably in bevy and it compiles but does not modify it. Why?
The unofficial bevy cheat book explains how queries work:
The first type parameter for a query is the data you want to access. Use & for shared/readonly access and &mut for exclusive/mutable ...
0
votes
1
answer
72
views
What is wrong with my voxel terrain generator. Terrain generator is not making seamless terrain
So as the title says, I'm making a voxel engine using rust and bevy and I am currently working on the terrain generation. I decided to use a heightmap that was made using simplex noise. This is how a ...
0
votes
1
answer
96
views
How are event handlers with unknown number of parameters done in popular crates?
I'm noticing more and more often that different rust crates use registration of event handlers with any set of parameters the user wants, not the library developer. I have seen this in the following ...
1
vote
1
answer
173
views
Rust Bevy cannot run the release executable file; missing libbevy_dylib
I built Bevy on Ubuntu, but when I try to run the executable file in the target/release folder, it logs the following error:
./BevyPractice: error while loading shared libraries: libbevy_dylib-...
0
votes
1
answer
181
views
How to move a NodeBundle In bevy
I have a node bundle like this:
commands.spawn((
NodeBundle {
style: Style {
position_type: PositionType::Absolute,
height: Val::Px(100.0),
...
0
votes
0
answers
41
views
Importing bevy assets inside pseudo "microfrontend"(Nextjs multizones)
I have a bevy app, that I want to rewrite to Nextjs multizones.
Here's my next.config.js:
async rewrites() {
return [
{
source: '/wasm-shuttle',
destination: https://bevy-...
0
votes
0
answers
127
views
Using bevy 3d results in error spam from WGPU-HAL
The exact error message I am getting:
2024-06-10T19:28:29.823391Z ERROR log: wgpu-hal heuristics assumed that the view dimension will be equal to `D2` rather than `D2Array`.
`D2` textures with `...
0
votes
1
answer
93
views
How can I edit the transform component of a child entity?
I have a TextBundle as a Children of an Entity with a SpriteBundle.
I want to change the transform of both of these in a query, I tried something like this:
mut query: Query<(Entity, &Creature, ...
0
votes
0
answers
201
views
error while trying to run bevy fragment shader
I'm trying to achieve a pixelated look to a 3d render in Bevy 0.13.2.
After some tutorial following I've ended up at this for my Bevy side code:
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
...
1
vote
1
answer
82
views
How can I re-use the same plugin but with differents parameters?
To continue my learning with Bevy (game engine programming in Rust), I wanted to create a custom plugin where I can pass parameters directly. Everything works well! I wanted to add the plugin twice ...
0
votes
1
answer
159
views
bevy children looking at other entities
Hi have a simple system where I bundle a Marker component in with the player which all of the watchers look at.
This code allows for the marker to be anywhere from the parent down at any child level.
...
1
vote
1
answer
107
views
Make subdivisions for a plane3d in the Bevy game engine v0.13
In the latest version v0.13 of the Bevy game engine, how do you go about making a mesh from a Plane3d shape with specified number of subdivisions?
In v0.12 you could do like this:
let mut mesh = Mesh::...
0
votes
0
answers
159
views
How to Improve Mesh update times with Bevy, WGPU, and WGSL
My Goal
I am trying to make a terrain system with a LOD system using a modified surface nets algorithm. I build the terrain using a voxel octree which makes updating the terrain from player movement, ...
1
vote
1
answer
190
views
Trying to render a checkerboard with Bevy
I'm trying to render a checkerboard (or make a grid-based system in general) in Bevy.
I have this component:
#[derive(Debug, Component)]
/// Defines a single grid.
/// As `Cell` is a term used in Rust ...
0
votes
1
answer
474
views
Bevy loading assets relative to debug binary instead of project root
I'm getting the following error when loading a GLTF model:
ERROR bevy_asset::server: Path not found: /path/to/project/target/debug/assets/model.glb
I'm loading the model with
commands.spawn(...
0
votes
1
answer
350
views
Extract icons from exe in Rust?
I have the path to an exe.
How do I get a Vec<RgbaImage<u8>> of the images contained within?
I'm fine using Windows-specific APIs.
I'm also using Bevy, so math structs from that is ...
0
votes
1
answer
79
views
Unexpected behaviour when reading buffer in gpu land (wgsl)
Using the bevy engine I have made an octree that I am serialising and writing to a buffer:
#[derive(Serialize)]
pub struct Octree {
pub root: [u32; 3],
pub width: u32,
pub leaves: Vec<...
0
votes
1
answer
48
views
How to swap color materials in an update call?
During bevy setup, I've spawned multiple rectangles with two different colors. How do I update these rectangles with a new color material?
// in setup
commands.spawn(
(MaterialMesh2dBundle {
...
1
vote
1
answer
535
views
Running the bevy breakout example in WSL
I am trying to run the bevy breakout example on a Windows PC with Ubuntu inside a WSL shell. I followed the bevy quick start guide. But I get this error:
Command:
cargo run --example breakout
Message:...
-1
votes
1
answer
51
views
Ron file not detected by browser
I am trying to compile foxtrot app( with my modifications) to WASM. I have found most of the problems with Vulkan, OpenGl and WPU. Now I have another one. It seems that the browser doesn't see ron ...
0
votes
0
answers
175
views
Aligning mesh to a dynamic rapier 3D rigidbody
Here I load the gltf file into the world and make rigid bodies for it, but when the rigidbody is dynamic then the visual mesh stays in air and the rigid body falls on the ground
What I am trying to do ...
0
votes
1
answer
66
views
bevy 0.12 keeps creating bevy-render 0.11.3<
I wanted to modify and build this app to wasm: https://github.com/janhohenheim/foxtrot/tree/v0.3.0
After some refactors I have removed particles plugin, added my own features and now want to build it ...
1
vote
1
answer
204
views
Confused about the timing of event updates and consumption in Bevy
I am trying the following code to learn about the Event in the Bevy engine:
use bevy::prelude::*;
use std::io::{self, BufRead};
use std::time::Duration;
fn runner(mut app: App) {
let stdin = io::...
0
votes
1
answer
101
views
Copy from Render World to Main World using Bevy 0.12/0.13
I would like to copy a resource from the render world to the main world. How can I achieve this?
e.g., I have a resource like this:
#[derive(Resource, Clone, Deref, ExtractResource, Reflect)]
pub ...
1
vote
2
answers
482
views
Request data from webserver at runtime Rust/Bevy/Wasm
I have a small game on my website and im trying to implement a leaderboard. For this to work, I need to fetch the high scores to compare the current score to and then post back the updated list when I’...
0
votes
1
answer
55
views
mapping and reading buffer does not give expected outcome
I am trying to run a simple test compute shader.
But when i map the buffer the shader modifies i get back all 0's. Instead of the expected outcome of numbers[index] = numbers[index] + 2u
it also does ...
2
votes
0
answers
98
views
What is AssetMetaCheck?
I am reading https://github.com/PraxTube/magus-parvus.
https://github.com/PraxTube/magus-parvus/blob/e91e2428d7e63abee6c400320256185315fbb219/src/main.rs#L36
.insert_resource(AssetMetaCheck::Never)
I ...
0
votes
0
answers
90
views
getting modified buffer from compute shader
so i am trying to write some compute shaders but this is my first interaction with anything gpu. So the problem i am having is that i am not getting the results back from the shader.
here is my code ...
1
vote
2
answers
157
views
How to get the computed mass of a Collider in Bevy / Rapier3d?
I have a Mesh with a ConvexDecomposition Collider using bevy_rapier3d.
How can I figure out the mass that rapier computes for this collider?
My code looks something like this:
fn asset_loaded(
mut ...
0
votes
1
answer
226
views
trouble with using compute shaders for bevy 0.12
I am trying to just test out the compute shaders so I'm trying to add 2 arrays together but I get this error during run time:
thread 'Compute Task Pool (6)' panicked at C:\Users\bramb\.cargo\...
0
votes
0
answers
91
views
faster way to iterate through a chunk of voxels in rust?
so i am making chunks of voxels (128x256x128) and need to iterate through those positions to first create the voxels:
for x in 0..=width {
for z in 0..=depth {
let noise_value1 = noise.get(...
0
votes
1
answer
284
views
Bevy first-person player model is not visible
I've been trying to make an FPS game with bevy. I ran into an issue on the second day, which is that if I attach the player's arm and weapon model to the camera, then it is not visible. It appears ...
0
votes
0
answers
36
views
Rigid body in player add velocity to it
I have the following function that well spawn my player and adds a little physics to it rigid body and so on
fn spawn_player(mut commands: Commands, assets: Res<AssetServer>) {
let player = (...
1
vote
0
answers
44
views
cannot borrow `element_childre` as mutable more than once at a time `element_childre` was mutably borrowed here in the previous iteration of the loop
I have this code. children are from Bevy query.
let mut array_of_elements = vec![];
for &child in children.iter() {
let result_element = ...
-1
votes
1
answer
79
views
captured variable cannot escape `FnMut` closure body `FnMut` closures only have access to their captured variables while they are executing
I have this code. children are from Bevy query.
let array_of_elements = children.into_iter()
.filter_map(|&item| {
match element_children....
0
votes
0
answers
126
views
Pass bevy children query elements array to function
I need to pass an array of children to function. I tried it in two ways:
By pushing children to previously created mutable array.
with iterator
fn object_interactions(
mut dialog_query: Query<...
0
votes
0
answers
361
views
How to create a custom Bevy bundle from a bundle with custom material
My goal is to create a custom Bevy bundle that extends a built-in one so that I can reuse it. I start with MaterialMesh2DBundle which I've modified to have a custom fragment shader by changing the ...
3
votes
0
answers
195
views
Seams on noise WGSL shader, porting gdshader to wgsl (bevy)
left is wgsl, right is gdshader
Bevy MRE here
I am trying to port a water shader written in gdshader to WGSL (in Bevy).
However I noticed that there is some seaming going on. After some time I figured ...
2
votes
1
answer
371
views
Can I stop Bevy from using the CPU when there is no need to redraw the screen?
I'm just looking at the examples in Bevy, and I tried one of them with
$ cargo run --example blend_modes -r
and I noticed that it shows 30% CPU usage even when the screen does not change. I think ...