-
Notifications
You must be signed in to change notification settings - Fork 24
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
Extend WorldBody methods #550
Comments
So, for instance, per this, for
|
This issue brings up questions for me:
|
When I first came across these, I actually thought it might be a mistake to have any methods other than these, because these are often better to use to make sure that the world state always remains synchronized to the modifications you make. However, I realized such a change might require exposing the specific setters of the components to the world implementation.
I'm not sure if the difference is clear enough actually. Is it correct that the specific shapes and joints only have
I actually like this solution very much! It would simplify things a lot if the CreateBody(world).UseType(BodyType::Dynamic).Use(shapes); But then the Removing them would also reduce maintenance because preferably the If going for this approach, I think I would just drop the convenience methods completely as well. Another upside of this is when you press the |
I appreciate the feedback. It's helpful for me.
Currently, yes. Specific shape types and joint types are all named with a pattern of Incidentally, I have been considering dropping the
With respect to a coding pattern like that, that's not too different syntactically from the But, I think the coding pattern you mention could run against the separation of spaces that I want. This is where getting the body from the world is like asking the kernel for a copy of kernel state, and changing the body is a copy back into the kernel. The kernel in this case conceptually being the A setup I'm striving towards in this regard is being able to have worlds implementable on speciality hardware like GPUs without changing the user's interface. I think this also simplifies exporting the engine to other languages without having to reimplement it all in the other language. I can imagine the separation could be maintained by having that kind of |
I would definitely prefer that!
That sounds like a kinda cool solution, as long as it doesn't become too complex for the average user to wrap their head around it. I was thinking another way to do it is to just call CreateBody(world, Body{}.UseType(BodyType::Dynamic).Use(shapes)); |
Current behavior:
I think the methods defined in the
WorldBody
,WorldJoint
,WorldShape
... and so on, are the best ones to use when updating the state (unless you are modifying multiple values at once and care a lot about performance). A couple examples:Partly because they turn three lines of code into one, but mostly because it's so easy to otherwise forget to call
SetBody(world, id, body)
orSetShape(world, id, object)
or whatever when you're done modifying the object. I believe it's especially easy for programmers new to C++ to forget thatGetBody
for example returns the body by value, and not by reference.These "helper" methods does however not cover all the different setters of the objects which makes it a bit inconsistent.
Desired improvement:
All
Set
-methods to bodies, contacts, joints, shapes and what not, should have a corresponding "world" method equivalent that provides the functionality to modify the value directly in theWorld
state.The text was updated successfully, but these errors were encountered: