Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Froyok
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I likely have a very simple question, but being not super familiar with C/C++ in general I prefer to ask to be sure. I hope you won't mind.
First to give some context: I'm using the C wrapper of Jolt C# version to support Jolt Physics in my project. My project is built in Love which is a framework that run Lua scripts. With the library FFI I'm able to use external C libraries, so that's how I'm able to get Jolt working.
I got basic objects and collisions working and I started to look at sensors (for trigger volume mainly). Because Love use LuaJit to provide good performance, there is a limitation around callbacks. Callbacks cannot be triggered from another thread, which is what Jolt does by default. My solution to this has been to write another little C shared library to wrap the callback function (with the idea of using a mutex lock and storing the event results into an array I would access later).
My question is the following: because the ContactListener function gives pointer to objects, what is the lifetime of those objects ? Can I expect them to still be valid even after the Update function of the physics system has run (aka until the next one) ? Or should I do an explicit copy of the data ? Thinking about the ContactSettings for example.
My idea what to store the add/remove event in arrays that I would consult after the Update function ran.
Beta Was this translation helpful? Give feedback.
All reactions