Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make an object hold Obi Fluid?
#1
I'm working on simulating a Chemistry Lab in Unity. Here's what it looks like right now: https://file.io/6cEnvfVUCXTK. But I'd like to make my object hold Obi Fluid. Here's the mesh: https://imgur.com/a/dz5o3ue. I've tried it with a different object that had more vertices as well, so I'm not sure what's wrong. I suspect that it's an issue with the mesh, but can someone please help? Thanks Sonrisa
Reply
#2
(09-10-2024, 02:11 AM)vivi_j Wrote: I'm working on simulating a Chemistry Lab in Unity. Here's what it looks like right now: https://file.io/6cEnvfVUCXTK. But I'd like to make my object hold Obi Fluid. Here's the mesh: https://imgur.com/a/dz5o3ue. I suspect that it's an issue with the mesh, but can someone please help? Thanks Sonrisa

Hi!

How have you set the collider up and what collision parameters are you using in your solver? Could you share your collider and solver settings?

(09-10-2024, 02:11 AM)vivi_j Wrote: I've tried it with a different object that had more vertices as well, so I'm not sure what's wrong.

Objects collide against triangles, not vertices. And the more triangles your object has, the costlier collision detection will become at no extra advantage. You should strive to use as few triangles/vertices as possible.

Also note that how you're moving the container has a large impact on behavior. Make sure you're moving it using physics (joints, AddForce, modifying their velocity, etc), instead of just setting its transform position - as that essentially teleports objects around ignoring physics, and as a result fluid will be left out of the container as you move it around.

kind regards,
Reply
#3
(09-10-2024, 08:12 AM)josemendez Wrote: Hi!

How have you set the collider up and what collision parameters are you using in your solver? Could you share your collider and solver settings?


Objects collide against triangles, not vertices. And the more triangles your object has, the costlier collision detection will become at no extra advantage. You should strive to use as few triangles/vertices as possible.

Also note that how you're moving the container has a large impact on behavior. Make sure you're moving it using physics (joints, AddForce, modifying their velocity, etc), instead of just setting its transform position - as that essentially teleports objects around ignoring physics, and as a result fluid will be left out of the container as you move it around.

kind regards,
Yes! Here's what it looks like: https://imgur.com/a/chemistry-flask-foll...er-bbCEPZg. I really just looked at the Faucet and Bucket sample scene and tried to replicate it with my erlenmeyer flask.

Also, gotcha about the triangles! I'm super new to this, so I'm trying to make sense of it.

When you say moving the container, are you referring to moving it via a script or manually? I've tried moving the bucket y'all provided with OVR hands and it works just as fine. I don't have any additional scripts in this project (especially nothing to deal with teleportation) whatsoever since I just wanted to test and see if Obi Fluid would be viable for my project.
Reply
#4
(09-10-2024, 07:58 PM)vivi_j Wrote: Yes! Here's what it looks like: https://imgur.com/a/chemistry-flask-foll...er-bbCEPZg. I really just looked at the Faucet and Bucket sample scene and tried to replicate it with my erlenmeyer flask.

Everything collision-related seems ok. Double check that your flask mesh is readable by the CPU, (in the model import settings, check "read/write enabled") otherwise the engine won't be able to read the mesh data and as a result nothing will be able to collide against it.

In the ObiSolver component, there's a warning stating that you haven't installed any of the Burst dependencies. As a result, Obi will run slower than it could. Please check the setup guide:
http://obi.virtualmethodstudio.com/manua...setup.html
http://obi.virtualmethodstudio.com/manua...kends.html

(09-10-2024, 07:58 PM)vivi_j Wrote: When you say moving the container, are you referring to moving it via a script or manually?

Everything that happens in a game happens because there's a script doing it (either written by you, or part of a library/asset). So not sure what you mean by "manually", as opposed to script-driven?

(09-10-2024, 07:58 PM)vivi_j Wrote: I've tried moving the bucket y'all provided with OVR hands and it works just as fine. I don't have any additional scripts in this project (especially nothing to deal with teleportation)

There's basically two ways to move an object: via physics or via modifying its transform. The most common one is modifying the transform, like this:

Code:
object.transform.position = newPosition;

This is to be regarded as "teleportation", since the object will ignore physics and just get moved to a new position instantly. So if you were doing flask.transform.position = hand.position; that would not allow the flask to contain fluid as the fluid would have no clue when/where the flask is going to move: the flask would just move to a new position and leave the fluid -or other objects contained inside it- behind.

Moving an object via physics involves modifying the object's velocity, either directly or indirectly (adding a force, impulse, acceleration, etc) which is what the OVR HandGrabInteractable script does, judging from its documentation.

kind regards,
Reply
#5
(14-10-2024, 08:23 AM)josemendez Wrote: Everything collision-related seems ok. Double check that your flask mesh is readable by the CPU, (in the model import settings, check "read/write enabled") otherwise the engine won't be able to read the mesh data and as a result nothing will be able to collide against it.



In the ObiSolver component, there's a warning stating that you haven't installed any of the Burst dependencies. As a result, Obi will run slower than it could. Please check the setup guide:
http://obi.virtualmethodstudio.com/manua...setup.html
http://obi.virtualmethodstudio.com/manua...kends.html


Everything that happens in a game happens because there's a script doing it (either written by you, or part of a library/asset). So not sure what you mean by "manually", as opposed to script-driven?


There's basically two ways to move an object: via physics or via modifying its transform. The most common one is modifying the transform, like this:

Code:
object.transform.position = newPosition;

This is to be regarded as "teleportation", since the object will ignore physics and just get moved to a new position instantly. So if you were doing flask.transform.position = hand.position; that would not allow the flask to contain fluid as the fluid would have no clue when/where the flask is going to move: the flask would just move to a new position and leave the fluid -or other objects contained inside it- behind.

Moving an object via physics involves modifying the object's velocity, either directly or indirectly (adding a force, impulse, acceleration, etc) which is what the OVR HandGrabInteractable script does, judging from its documentation.

kind regards,
The mesh wasn't readable - thanks for catching that!
By manually, I meant moving an object with OVR hands, but yes - I've looked thru the documentation and it looks like it does move as intended. Thanks, again Sonrisa
Reply