Comments (5)
Hi, thanks @elegaanz!
Adding a new collision shape shouldn't be too hard. Add the new variant to Body
(in core
crate) and let the compiler tells you what else you need to change.
However.... I am currently making some big changes (see: #31 (comment)). So you might want to wait 2-3 days, to avoid unnecessary conflicts. (I plan to merge theses changes this weekend)
from heron.
Ah, and if you need help, you can either open a draft PR and/or contact me on discord (@jomag)
from heron.
I merged the changes I was talking about. So you can take the latest version of main
and work from there.
Yes, you can use #[cfg(feature = ...)]
. It looks like the best option in this case.
The Vec<Vec<f32>>
is acceptable too. I'm don't know a nice dynamically sized matrix type that could replace this.
You'll also needs a scale
member that tells the distance separating each height value of the vector/matrix.
In 2d it's a f32
, and in 3d it's a Vec2
. But, we may simplify it by forcing the user to use the same scale for both axis in 3d. This is anyway the most common, and as a matter of fact, I've never seen a height map with a different scale in x than in y. That means the scale
could always be a f32
in both 2d and 3d.
enum CollisionShape {
// ...
#[cfg(not(all(feature = "2d", feature = "3d")))]
HeightField {
scale: f32,
#[cfg(feature = "2d")]
heigths: Vec<f32>,
#[cfg(feature = "3d")]
heigths: Vec<Vec<f32>>,
}
}
P.S. The enum is now named "CollisionShape" ;-)
from heron.
Hi, I would like to help implement that, would a PR be accepted? (edit: I just saw the "up-for-grabs" label) If yes, do you have any tip or things I need to know about the code base or this issue before I get started?
from heron.
I started something, just to get a bit more familiar with the code, even if I need to redo it in a few days, and I have a question: in 2D heightfields are defined by a single-dimension array, but for 3D you need a matrix/two dimensional array. Is something like that a good idea?
enum Body {
// ...
HeightField {
#[cfg(feature = "2d")]
heigths: Vec<f32>,
#[cfg(feature = "3d")]
heigths: Vec<Vec<f32>>,
}
Or is there a better way?
from heron.
Related Issues (20)
- Crash in 3d when the collision shape has no depth HOT 14
- [ignore] Gravity component is only publicly available via deprecated import HOT 1
- Re-enable debug-3d since bevy_debug_lines implemented bevy 0.7 support HOT 3
- KinematicVelocityBased rotation is applied in world-space instead of object-local-space HOT 4
- Dependency Dashboard
- The automated release is failing 🚨
- RigidBodies clip/sink into static geometry at slightly high speeds HOT 8
- How to work with other Bevy versions
- ColliderBundle HOT 8
- Recommend using SI units HOT 1
- Sensor affects velocity HOT 3
- bevy lyon 2dDebug Stage Conflict
- How to ignore Gravity with Dynamic RigidBody?
- Possible Issue with Raycasting HOT 2
- dependency confict with bevvy 0.8 HOT 1
- Action Required: Fix Renovate Configuration HOT 2
- could not find `prelude` in `heron`
- Support bevy 0.8 HOT 2
- Collision events not firing HOT 1
- Collision events for sensor always firing, PhysicsLayer issue or incorrect setup?? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from heron.