Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Obi Softbody's interaction with VR hand
#2
(26-04-2022, 02:33 PM)chaunce_1121 Wrote: Hi, I have a problem with VR first person picking up objects that have obi softbody component. Like the dragon that was given in the package, I want to grab that object using my SteamVR hands using the VIVE, but it will just go through. I was trying to give the hands OBI collider, but they dont have a collision itself so that doesn't work. Is there any way that I can pick the dragon up instead of just leaving it on a table?

Hi there!

This of course won't work *automagically*, because neither VIVE or SteamVR know anything about Obi or the other way around. There's many different possible ways to do this, but it is something you need to implement yourself - how to approach it depends on what your game requires and how exactly you want this hand/softbody interaction to work.

There's no catch-all built in solution in Obi to do it. Some sample scripts are included, such as the ObiParticlePicker used in the dragon sample scene, which implements interaction by recasting against the particles and applying an external force to the first one along the ray. This however assumes you want to pick things by pointing with the mouse cursor and then applying a force to them.

Another sample script is ObiContactGrabber, which detects particles in contact with a collider and then sets their position when you call its Grab() method. This assumes you have colliders around and want kinematic interaction with the particles - directly setting their position as opposed to applying a force to them.

In any picking/grabbing/dragging mechanism you basically want two things:

1) - Detect whether the hand/cursor/grab utensil is close to any object (in Obi's case, softbody particle(s)).
2) - If it is, determine whether it should move these particles and how it should move them.

1) Can be done in a variety of ways. For instance, if your hand does not have a collider, you can add one to it (can be just a trigger, so that the hand doesn't collide with stuff) and then use collision callbacks to detect particles in close proximity or in contact with it: http://obi.virtualmethodstudio.com/manua...sions.html

Another option is to use spatial queries to determine particles, if you don't want to use colliders:
http://obi.virtualmethodstudio.com/manua...eries.html

Again, there's several options to use: box query or distance query if you want to detect particles by proximity, or maybe a raycast if you want to grab things by pointing at them.

2) Once you know which particle(s) to move, you can set their position directly, set their velocity, or maybe add a force to them. You can modify any per-particle property by using the particles API:
http://obi.virtualmethodstudio.com/manua...icles.html

let me know if you need further help,
Reply


Messages In This Thread
RE: Obi Softbody's interaction with VR hand - by josemendez - 27-04-2022, 08:04 AM