promethia-27 / bevy_mod_wanderlust Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
I put together something from ControllerState
and ControllerService
to signal the start of each jump with the character
struct JumpState{
is_jumping: bool
}
impl for JumpState{
fn jump_started(&mut self, state: &ControllerState, settings: &ControllerSettings) -> bool {
if (0 < controller_state.remaining_jumps
|| controller_state.coyote_timer == controller_settings.coyote_time_duration)
&& controller_state.jump_pressed_last_frame
&& !self.jumping
{
self.jumping = true;
true
} else {
self.jumping = false;
false
}
}
}
It could be as short as:
fn jump_started(state: &ControllerState, settings: &ControllerSettings) -> bool {
controller_state.jump_pressed_last_frame && controller_state.is_grounded
}
I belive the information is generic enough to be included, and it is calculated in:
bevy_mod_wanderlust/src/systems.rs
Line 101 in 63fef1c
Something seems to have changed in bevy_rapier3d to cause jitter in the FPS example when running into walls again. Will have to investigate.
Also there seems to be an additional debug render mesh that wasn't there before? A bit obnoxious.
The idea is that an Option can be given as an anchor point for the controlled character;
struct GrapplingHook{
spring: Spring,
length: f32
}
If it contains the struct, A spring-like force can be applied to the Character to correspond to the hook.
bevy_mod_wanderlust/src/spring.rs
Line 9 in 4925e63
Handling could be similar to this :
bevy_mod_wanderlust/src/systems.rs
Line 144 in 4925e63
Hey this plugin is lovely, but it seems to me that it's missing the ability to specify a desired facing direction and smoothly turn towards that direction.
This would be useful for a game like PlateUp! or Overcooked where your character needs to face in specific directions to interact with things in the game world.
I'd originally hacked this turning in by calculating the torque necessary and then applying that as ControllerInput::custom_torque
, but it was pretty easy to jam into Wanderlust as seen here.
I'd put this up as a PR, but it's pretty roughly implemented.
2022-07-26T13:38:02.035854Z INFO bevy_render::renderer: AdapterInfo { name: "Intel(R) Xe Graphics (TGL GT2)", vendor: 32902, device: 39497, device_type: IntegratedGpu, backend: Vulkan }
2022-07-26T13:38:02.061049Z ERROR bevy_mod_raycast::primitives::rays: Unable to get screen size for RenderTarget Window(WindowId(00000000-0000-0000-0000-000000000000))
2022-07-26T13:38:02.061080Z ERROR bevy_mod_raycast::primitives::rays: Unable to get screen size for RenderTarget Window(WindowId(00000000-0000-0000-0000-000000000000))
thread 'Compute Task Pool (0)' panicked at 'called `Option::unwrap()` on a `None` value', /home/declan/.cargo/git/checkouts/bevy_editor_pls-aa84c1e9122cf1d6/63872f9/crates/bevy_editor_pls_default_windows/src/cameras/camera_3d_free.rs:130:44
Hi! Now that I've had the chance to run the examples I see this control is awesome!
I would love to use it in my projects, but unable to set it up for some reason ..
Cargo.toml:
[package]
name = "main"
version = "0.1.0"
edition = "2021"
[workspace]
resolver = "2" # Important! wgpu/Bevy needs this!
[dependencies]
bevy = { version = "0.10", features = [
"bevy_render",
] }
bevy_rapier3d = { version = "0.21", features = [
"async-collider",
"dim3",
] }
bevy_prototype_debug_lines = { version = "0.10", features = [
"3d",
], optional = true }
bevy_mod_wanderlust = "0.2.2"
[dev-dependencies]
bevy = "0.10"
bevy_editor_pls = "0.4"
bevy_rapier3d = { version = "0.21", features = ["debug-render"] }
# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 1
# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3
The following main.rs:
use bevy_mod_wanderlust::WanderlustPlugin;
fn main() {
bevy::app::App::new()
.add_plugin(WanderlustPlugin)
.run();
}
Produces the compile error:
Checking main v0.1.0
error: src/main.rs:5: the trait bound `WanderlustPlugin: Plugin` is not satisfied
error: src/main.rs:5: the trait `Plugin` is not implemented for `WanderlustPlugin`
error: src/main.rs:5: required by a bound introduced by this call
help: src/main.rs:5: the following other types implement trait `Plugin`:
AnimationPlugin
AssetCountDiagnosticsPlugin<T>
AssetPlugin
AudioPlugin
BlitPlugin
BloomPlugin
CameraPlugin
CameraProjectionPlugin<T>
and 55 others
...
error: could not compile `main` due to 2 previous errors
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.