-
-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RigdBodyDesc can't be stored #205
Comments
Hi! I'm currently attempting to allow the user to manage itself the set of rigid bodies (outside of the physics world),. That should solve your problem here. |
Do you mean make the RigidBody available even if not assigned to the world yet? In this case it will improve a lot the integration that I'm doing |
Basically the user will responsible for managing the set of bodies. A reference to this set will have to be passed to every methods like |
This seems nice but instead to pass the whole array per each call, what do you think about insert an array of weak pointers inside the world? So the user can handle the bodies as he prefer. |
By trait BodySet<'a, N: RealField> {
type Body: ?Sized + Body<N>;
type Handle: Copy;
type Iter: Iterator<Item = (Self::Handle, &'a Self::Body)>;
type IterMut: Iterator<Item = (Self::Handle, &'a mut Self::Body)>;
fn get(&self, handle: Self::Handle) -> Option<&Self::Body>;
fn get_mut(&mut self, handle: Self::Handle) -> Option<&mut Self::Body>;
fn contains(&self, handle: Self::Handle) -> bool;
fn iter(&'a self) -> Self::Iter;
fn iter_mut(&'a mut self) -> Self::IterMut;
} This trait is what I am experimenting with. The fn step<'a, N: RealField, Bodies: BodySet<'a, N>() {
....
} Having the world store a weak pointer isn't desirable as it would require the user to rely on some form of shared pointers like |
This is perfect for what I'm doing! Do you already have a PR / branch that I can keep an eye on it? Because get rid of the builder will make my life much easier. |
Not yet, it's still very experimental. It will likely end up in the ccd branch within a couple of weeks if it ends up working well. |
Ok thanks! |
The RigidBodyDesc accept a reference to the colliders https://github.com/rustsim/nphysics/blob/master/src/object/rigid_body.rs#L727
The problem is that due to the lifetime used there is not possible to store the RigidBodyDesc in the heap and move it around.
Since the RigidBody only exist inside the world, and I need to manipulate its parameters even out of the world, would be nice to be able to store them directly inside the descriptor.
The text was updated successfully, but these errors were encountered: