You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please notice that every single method in ActorMap requires &mut self, but WakeSleepCallback only gives access to &self, thus making wake_sleep callback unusable as is.
Any physx user can of course cast pointers by herself similar to how ActorMap does it internally, but that's not ideal.
Proposed solution
rename existing cast_map and as_* to cast_map_mut and as_*_mut respectively.
add cast_map and as_* functions which take &self and return Option<&self>
For example:
// instead of thispubfnas_rigid_dynamic(&mutself) -> Option<&mutD>{/*...*/}// suggesting to do thispubfnas_rigid_dynamic(&self) -> Option<&D>{/*...*/}pubfnas_rigid_dynamic_mut(&mutself) -> Option<&mutD>{/*...*/}
The text was updated successfully, but these errors were encountered:
Seems sensible for me as described here -- feel free to open a PR with the changes.
I noticed this callback is set up in the examples but never actually used. If you have a use-case, can you maybe extend the examples (ball_physx.rs)? Would help catch regressions in the future too.
rlidwka
added a commit
to rlidwka/physx-rs
that referenced
this issue
Jul 17, 2023
Description of the problem
I'm trying to register
on_wake_sleep
callback, which has the following signature:ActorMap as of now has the following implementation (link):
Please notice that every single method in
ActorMap
requires&mut self
, butWakeSleepCallback
only gives access to&self
, thus making wake_sleep callback unusable as is.Any physx user can of course cast pointers by herself similar to how ActorMap does it internally, but that's not ideal.
Proposed solution
cast_map
andas_*
tocast_map_mut
andas_*_mut
respectively.cast_map
andas_*
functions which take&self
and returnOption<&self>
For example:
The text was updated successfully, but these errors were encountered: