Replies: 3 comments 2 replies
|
My preference is to use the defs as much as possible and only have set/get for things that are changing over time. However, I get many requests to allow everything to be tweakable after creation. I agree this is redundant. Some people prefer to have no def and all set/get. I like the def because it is more efficient, so people that care a lot about performance will make maximal use of the defs. |
|
I agree, I'm suggesting more def use, not less. IE a batched get similar to b2Default...Def and a batched set similar to b2Create... was my first instinct. That design just gets into a little bit of trouble since defs contain values that probably shouldn't be changed like this. Maybe even some values that cant? Sorry if I got a bit lost thinking of that issue. |
|
So you want to be able to get the You could write your own wrapper to do that - but the issue would be that some fields will be stale if the world is stepped. So you can't just keep submitting the same |
Uh oh!
There was an error while loading. Please reload this page.
I'm currently wiring up a generic lua interface to box2d and box3d and
while doing so I'm looking at the exposed interface as a whole.
It occurs to me that with the use of def structures in creation that
many of the get/set functions are seldom used.
Adjusting these values after creation seems unlikely and only
occasionally needed?
Multiple get/set functions could be replaced with a batched get/set for
each internal object that also works on a def structure reducing the
API foot print and generalizing creation/update code.
Perhaps separate the current def structures into dynamic and constant
or "variable" values so this can be more explicit.
dynamic meaning values box itself updates so you are going to need to
get them later. These values such as body transform still requiring
their own get/set functions as well as being set during creation.
constant meaning values that should really only be set at creation
time. My thinking is anything where a change should not happen or would
cause a major update of internal structures. Replacing the current
object with a brand new one always being an option if you really need
to change them.
"variable" meaning values that may be updated later and changes will
not stress the engine. These lighter variable values could be shunted
into a sub def and then a batched get/set with a get them all, modify,
then set them all approach.
Good for joints with lots of twiddly bits?
Initially I was thinking that it made sense to have functions that
read/write the current values between an object and the def struct.
However it became obvious that it would be better to explicitly
separate out "variable" values.
I'm kinda doing this in my lua interface but it seems that this might
be a reasonable change to the C API as well so figured I should bring
it up.
Sorry bit of a current brain dump. :)
All reactions