Comments (5)
I'm fairly certain that changing it to pos1
would be correct, because my game state gets desynchronized after serialization and deserialization if I just use the current pos0
in the function.
from playrho.
I've run into this problem before too. But is this more of a wrong position, or more of a it-doesn't-work-as-expected problem?? I'm wondering this myself.
Even when I recently added the ability to set the sweep, I ran into this. Also, I ran into the gotcha of having to set resetMassData
to false.
from playrho.
But is this more of a wrong position, or more of a it-doesn't-work-as-expected problem??
I'm not sure either. I really have to emphasise that when I filed these issues I was almost completely blind to how things logically should work; I was solely looking at how I can recreate an exact copy of a serialized world, and I just found I had to change this function getting pos0
to pos1
for the equality to be true.
from playrho.
Some notes on this, at least for myself:
- In commit a709055,
playrho/d2/BodyConf.hpp
was changed to add support for configuring withSweep
information, instead of being limited just tolocation
andangle
(that form aPosition
that would setSweep::pos0
andSweep::pos1
to that value). - This meant that then one variable (
sweep
), spoke for what used to be two separate variables (location
, andangle
), and could then also convey state independently for the other stage of the sweep (sosweep.pos0
andsweep.pos1
can now both be set to what that had been - and not just to the samePosition
). - This also meant that
Body::m_sweep
could then be initialized byBodyConf::sweep
, instead of havingBody::m_sweep
initialized to the more limitedSweep{Position{bd.location, bd.angle}}
. - The question at hand seems to be whether the appropriate semantics of the
location
,angle
and theTransformation
of the formerBodyConf
have been preserved for the newBodyConf
while allowing the otherPosition
of theSweep
to be set independently. - The address of this question seems to be predicated on whether the changes to
BodyConf
match the behavior forBody
with respect to functions likeBody::GetTransformation
, which returnsBody::m_xf
, which itself is set fromGetTransform1
of the body's sweep, which in turn is the value ofGetTransformation(sweep.pos1, sweep.localCenter)
. - In other words, I'm seeing this as a relational consistency question.
So would it be more consistent for GetTransformation(const BodyConf& conf)
to return GetTransform1(conf.sweep)
(which is GetTransformation(conf.sweep.pos1, conf.sweep.localCenter)
) than {conf.sweep.pos1.linear, UnitVec::Get(conf.sweep.pos1.angular)}
? I believe so.
I'm gonna try this and see what unit testing reveals.
from playrho.
I've merged in changes now to the master branch to address this. Closing this assuming that it does. Please let me know though either way. Thanks!
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
- No equivalent "IsDestroyed" method in World interface HOT 6
- 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.