-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
There's no way to create joints (constraints) in the current API. #111
Comments
Hi, Thanks! |
Awesome! I was thinking perhaps it might just have been a minor oversight :) Thank you kindly! |
Hi, Cheers, |
Looks like I can access the constructors fine, now! However, I'm noticing that there might not be any way to access BodyLockMultiRead or BodyLockMultiWrite when creating constraints - | AngleJoint hingeJoint ->
let constraintSettings = new HingeConstraintSettings ()
constraintSettings.Point1 <- hingeJoint.Anchor
constraintSettings.Point2 <- hingeJoint.Anchor2
let mutable bodyLockWrite = Unchecked.defaultof<_>
let mutable body2LockWrite = Unchecked.defaultof<_>
try physicsEngine.PhysicsContext.BodyLockInterface.LockWrite (&bodyID, &bodyLockWrite) // NOTE: assuming that jolt needs write capabilities for these.
physicsEngine.PhysicsContext.BodyLockInterface.LockWrite (&body2ID, &body2LockWrite) // TODO: P0: send support request to JoltPhysicsSharp maintainer to expose BodyLockMultiWrite so that we don't get a deadlock here if accessing from another thread!
let body = bodyLockWrite.Body
let body2 = body2LockWrite.Body
let constrain = constraintSettings.CreateConstraint (&body, &body2)
constrain.Enabled <- bodyJointProperties.BodyJointEnabled
Some constrain
finally
physicsEngine.PhysicsContext.BodyLockInterface.UnlockWrite &bodyLockWrite
physicsEngine.PhysicsContext.BodyLockInterface.UnlockWrite &body2LockWrite This code could cause a deadlock according to https://github.com/jrouwe/JoltPhysics/blob/master/Docs/Architecture.md#multithreaded-access -
I'm guessing the issue is that the BodyLockMultiRead and BodyLockMultiWrite types haven't been exposed by the wrapper yet? |
Hi, Thanks |
I've integrated the API and gotten everything to compile and work without actually exercising the deadlock prevention behavior. The actual testing of the additional MT semantics of multi-locking behavior won't taken place on my end since I just needed the construct to make sure I don't get deadlocking in some speculative future (IE, as a sanitation best practice). Since I've not done the deep testing you might be wanting, I'm leaving closing the issue to your discretion. |
Hi, Thanks. |
Maybe I'm missing something obvious, but I don't see a way to actually create any instances of a joint like DistanceConstraint or DistanceConstraintSettings. All of the joint constructors are non-public and inaccessible.
Assuming this can't get fixed very soon in the wrapper, can someone advise me on how to perhaps create one via reflection? I just need to know how to pass the required
nint
handle into the ctor when calling the constructor's invoke.Thanks!
The text was updated successfully, but these errors were encountered: