Add mjs_detachBody to C API.
PiperOrigin-RevId: 626947850 Change-Id: I7c897048098ecd4f2247725ef2d378dbd00ef4a0
This commit is contained in:
committed by
Copybara-Service
parent
34a61ae42f
commit
cc78db41f4
@@ -110,6 +110,16 @@ const char* mjs_getError(mjSpec* s) {
|
||||
|
||||
|
||||
|
||||
// Detach body from mjSpec, return 0 if success.
|
||||
int mjs_detachBody(mjSpec* s, const mjsBody* b) {
|
||||
mjCModel* model = static_cast<mjCModel*>(s->element);
|
||||
mjCBody* body = static_cast<mjCBody*>(b->element);
|
||||
*model -= *body;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// check if model has warnings
|
||||
int mjs_isWarning(mjSpec* s) {
|
||||
mjCModel* modelC = static_cast<mjCModel*>(s->element);
|
||||
@@ -126,6 +136,14 @@ void mjs_deleteSpec(mjSpec* s) {
|
||||
|
||||
|
||||
|
||||
// delete body
|
||||
void mjs_deleteBody(mjsBody* b) {
|
||||
mjCBody* body = static_cast<mjCBody*>(b->element);
|
||||
delete body;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// add child body to body, return child spec
|
||||
mjsBody* mjs_addBody(mjsBody* bodyspec, mjsDefault* defspec) {
|
||||
mjCDef* def = defspec ? static_cast<mjCDef*>(defspec->element) : 0;
|
||||
|
||||
Reference in New Issue
Block a user