bastacyclop / rust_box2d Goto Github PK
View Code? Open in Web Editor NEWRust binding for Box2D
License: zlib License
Rust binding for Box2D
License: zlib License
Hello, found this issue when I were playing with shapes and getting it position.
For start I were using b2::CircleShape::new
without passing Vec2
and radius, which I thought was a problem of crash, but once I used new_with()
with Vec2
and radius, nothing changes. I have feeling that problem with getting position of CircleShape
itself.
Error: process didn't exit successfully: 'target\debug\examples\samples.exe' (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
Example:
let test_circle_shape = b2::CircleShape::new_with(b2::Vec2{x: -3., y: 0.}, 3.0);
test_circle_shape.position();
You might run it and it will crash immediately.
Seems to me like this is feasible and I'm happy to help
Hi, this code seems to have taken quite some effort, which is why I'm surprised that it's almost completely undocumented. By that I mean only source code is provided, even the official documentation is just source code with a search bar, no doc comments.
As a new user, this makes it extremely hard to use: things that could otherwise take a minute can take upwards of an hour (not to mention the possibility of something not even being supported).
I know this is supposed to be a thin wrapper around Box2D, however the difference is still large enough to cause confusion and necessitate documenting the edge cases.
Of course, for example, the step function or the idea of fixtures don't have to be documented. But how UserDataTypes are used and hundreds of other such things induced by the language difference totally require explanation.
Structs defined in c++, such as b2Vec2 seem to cause many problems when they are passed over the FFI by-value. I think the reason is different calling conventions for C vs C++.
It seems like functions returning structs as-value or taking structs as input argument as-value cause problems. Take Body::world_point() as example, it does not work and return undefined data or some times crash. (All other demos from the testbed work because they never use any such function).
It is implemented as follows:
pub fn world_point(&self, local: &Vec2) -> Vec2 {
unsafe { ffi::Body_get_world_point(self.ptr(), local) }
}
b2Vec2 Body_get_world_point(const b2Body* self, const b2Vec2* local) {
return self->GetWorldPoint(*local);
}
Here the argument "local" will point to garbage no matter how you call the funcition and the program crashes. This is because the return value is a b2Vec2 as-value and b2Vec2 is compiled as struct/class by c++ code while the function Body_get_world_point is treated as C-code.
Hey, I'd like to use this to make playdate games, but that would require no_std
support. It would be great to be able to use this on platforms and devices that don't have access to the standard library.
I see there is a dependency on nalgebra, I belive that weould need default features disabling, not sure about the other dependecies.
As someone with no C++ experience this has been rather confusing... what exactly is expected of the Box2D dependency regards its location and its contents? I've tried pointing to it locally w/ BOX2D_INCLUDE_PATH
as well as putting what I think are the correct Box2D contents in /usr/local/include/
to no avail. Help appreciated :-)
macOS, Rust 1.21.0
Spotted in #4: https://travis-ci.org/Bastacyclop/rust_box2d/builds/196365785.
I'll wait a bit to see if things fix themselves.
It looks like the Travis CI is not running on new commits anymore .. this needs to be investigated.
Hi,
thanks for this awsome bindings.
Is there any documentation on how to user UserData?
Thanks
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.