Introduce mjPreContact, a minimal struct passed into the collision functions.

PiperOrigin-RevId: 918533795
Change-Id: I2b5af05c1479b25d5c2cfdc690321a26fce6ede6
This commit is contained in:
Kyle Bayes
2026-05-20 10:47:11 -07:00
committed by Copybara-Service
parent 53b3137a12
commit 7174d33f08
25 changed files with 709 additions and 406 deletions
+20
View File
@@ -535,6 +535,26 @@ std::unique_ptr<MjModelWrapper> MjModelWrapper::Deserialize(
return std::unique_ptr<MjModelWrapper>(new MjModelWrapper(model));
}
// ==================== MJPRECONTACT ==========================================
#define X(var) var(InitPyArray(ptr_->var, owner_))
MjPreContactWrapper::MjWrapper()
: WrapperBase(new raw::MjPreContact{}),
X(pos),
X(normal),
X(tangent) {}
MjPreContactWrapper::MjWrapper(raw::MjPreContact* ptr, py::handle owner)
: WrapperBase(ptr, owner),
X(pos),
X(normal),
X(tangent) {}
#undef X
MjPreContactWrapper::MjWrapper(const MjPreContactWrapper& other)
: MjPreContactWrapper() {
*this->ptr_ = *other.ptr_;
}
// ==================== MJCONTACT ==============================================
#define X(var) var(InitPyArray(ptr_->var, owner_))
MjContactWrapper::MjWrapper()