Comments (6)
Out of curiosity, what flavor of interface for this info would you prefer:
IsDestroyed(const World&, EntityID)
.entity.IsDestroyed()
.std::optional<Entity> GetEntity(const World&, EntityID)
.
from playrho.
Out of curiosity, what flavor of interface for this info would you prefer:
- IsDestroyed(const World&, EntityID)
- entity.IsDestroyed()
- std::optional GetEntity(const World&, EntityID)
I would prefer 1 I think because it matches the signature of the Destroy
function.
from playrho.
I would prefer 1 I think because it matches the signature of the
Destroy
function.
Interesting to me that option 3 didn't get mentioned. Interesting in terms of discussion, because while I'm a fan of C++ vocabulary types like std::optional
, I'm also concerned about minimizing memory usage.
Specifically, making the underlying storage arrays that the implementing world uses be arrays of std::optional<T>
instead of arrays of T
seems more likely to be suboptimal bit-density wise than another possibility I'm thinking of.
In this case, PlayRho types like Body
and Contact
already provide boolean properties stored directly in bits packed optimally. That leads most naturally for me to options 1 and 2.
The more abstracted PlayRho types Shape
and Joint
don't seem to have as optimal, or, at least, not such a straight forward path for providing an is-destroyed piece of info. Perhaps the most straight forward to me is using their has_value
member function for this. That way, supporting types (like DiskShapeConf
for example), don't have to all change their interfaces to support this.
So I think that's what I'll do then, and why. I.e. provide interface 1 (and 2) for the PlayRho Body
, Contact
, Joint
, Shape
types. Assuming of course that this works out; I'm concerned I may yet encounter wrinkles with this design.
Relatedly from my thinking, and see issue #547, I'm continuing to consider removing all of the World
based functions GetBodies(const World&)
, GetContacts(const World&)
, GetJoints(const World&)
(and their implementation based counterparts).
from playrho.
The following is available now in current master branch:
IsDestroyed(const Body&)
.IsDestroyed(const Contact&)
.IsDestroyed(const Shape&)
.IsDestroyed(const Joint&)
.IsDestroyed(const World&, BodyID id)
.IsDestroyed(const World&, ContactID id)
.
Relatedly, manifolds would use the info for contact.
I still have to add the following however - I'd forgotten these but meant to add these as well:
IsDestroyed(const World&, JointID id)
.IsDestroyed(const World&, ShapeID id)
.
from playrho.
The following is available now in current master branch:
Funny thing I just realised I don't need them anymore since I just use the MakeTouchingMap
function now to filter the contacts. I think it's good to have them anyway!
from playrho.
This is complete now with PR #566.
from playrho.
Related Issues (20)
- ToSigned shouldn't be under playrho::d2
- Bug in cmake install: not all necessary headers get installed
- API documentation publication not part of CI HOT 1
- Make use of new allocator stats support
- Testbed, UnitTests, Benchmark require git recursive clone
- Pass values from the ShapeConf to other (sub)shape configs HOT 2
- Set multiple shapes to BodyConf at once HOT 3
- No GetShapes function HOT 4
- Incomplete equality operator for Body HOT 2
- Missing properties for BodyConf HOT 7
- Extend WorldBody methods HOT 5
- Should caches be compared in the equality operator for the world? HOT 2
- Missing getters and setters for flags and inv_dt0 (for serialization purposes) HOT 1
- Ability to manually create a Contact (for serialization purposes) HOT 2
- Wrong position for transformation HOT 5
- Incorrect manifolds when deserializing/recreating the World state HOT 2
- GetContacts GetBodies GetJoints but no GetShapes inconsistency
- Just two very similar functions HOT 4
- Make UnitVec initializing constructor public HOT 15
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 playrho.