|
|
Pulling object problem |
Posted by: cruzjunior - 19-05-2021, 06:50 PM - Forum: Obi Rope
- Replies (2)
|
|
I'm completely new to this asset and I have a problem that I cant seem to find a way to solve it.
I want to have a hook at the end of the rope and when that hook comes in contact with an object it attaches to that object and when the player pulls on the rope, the object comes wit it.
My first instinct was just to make the object a child of the hook but that doesn't seem to work, the object either does not move or glitches out.
Then I tried tying the object's transform to the hooks transform in script, so it moves when the hook moves without needing to parent, but then the problem with that was that the object would then would then go through other objects, completely ignoring the collider at some points, or launching other objects or itself into the stratosphere, and there was also the problem of the movement was not looking natural.
Is there an obvious way to do this that I am missing?
Thanks in advance!
|
|
|
Obi adding huge forces to rigidbodies when you delete ropes... (Repro project) |
Posted by: Hatchling - 19-05-2021, 04:49 PM - Forum: Obi Rope
- Replies (8)
|
|
So, this time I found that when you delete ropes, it can cause NaNs and absurd velocity assignments to rigidbodies when you destroy a rope's GameObject.
The repro package can be found here: (Expires in 30 days)
https://ufile.io/45i4log9
To reproduce:
- Start a new Unity project (I'm using 2020.2.0f1).
- Add Burst (version 1.4.8) and Jobs (version 0.8.0-preview.23) through the Package Manager.
- Import the package linked above.
- Open SampleScene.unity and press Play.
- Click and drag to attach a rope. The point where you click (mouse down) will be the first point where a rope gets attached. The point where you let go (mouse up) will be the second point where a rope gets attached. Add several ropes.
- Press [R] to delete all of the ropes you created.
- Repeat 4 and 5 until the bug is reproduced.
You'll see this when you reproduce the bug:- The rigidbodies in the scene may start behaving abnormally, with ghost forces pushing them around even though all of the ropes have been removed.
- You'll see errors spamming the console regarding invalid forces being applied to one or more of the rigidbodies. For example: rigidbody.velocity assign attempt for 'Floating Platform' is not valid. Input velocity is { 2.468001, NaN, 55.692116 }.
- Some of the rigidbodies may explode into outer space from the absurd forces.
Seems related to the previous bug I posted, with very similar symptoms.
Other symptoms I've noticed in fighting with this bug:- When I start SampleScene with a rope in the scene already, (drag ObiPrefabs/Rope into the scene and activate the GameObject before pressing play) any ropes you add to the scene will be frozen and will not simulate.
- After reproducing the above bug: When switching to the scene "RopeNet" (which uses a modified example script to use the global solver), pressing play, and then unpressing play, the console will spam about some phantom Obi.ObiLateFixedUpdater trying to poke at various destroyed Obi components. When this occurs, you'll find that there are no ObiLateFixedUpdater instances visible in the hierarchy.
Code modifications to note:- ObiStatic.cs added, which enables a global solver.
- ObiStaticSettings.cs added, which allows you to define the global solver using a prefab reference.
- When an ObiRope is created, it will check for a solver in one of its ancestors. If one isn't found, it'll use ObiStatic.WorldSolver, which will get instantiated if needed.
- RopeNet.cs will use ObiStatic.WorldSolver instead of creating its own solver.
|
|
|
How to query Obi geometry with raycasts? |
Posted by: Hatchling - 15-05-2021, 06:57 AM - Forum: Obi Rope
- Replies (15)
|
|
Does Obi provide the ability to query the geometry of Obi Actors, like how Physics.Raycast, .Spherecast, etc. allows you to query colliders?
I'm assuming that most of the math involved for this has already been done somewhere in there in order to support collision detection.
I see there is ObiParticlePicker, but it seems like this approach isn't optimal:- Only allows picking particles directly, instead of by their collision geometry (simplexes)
- Doesn't return a point on the surface that the ray first made contact
- Doesn't query the particle grid to filter out most of the tests
- Isn't written in efficient threaded code in the same way that other collision checks are
- Only considers one solver
- Cannot be invoked in a static way (like Physics.Raycast)
If I were more familiar with how to interface with the internal stuff of Obi, I'd be willing to write these queries myself. An interesting idea might be to provide some sort of base query class where you can implement custom queries (for example, getting the closest point on a simplex to the query point, within a certain radius (or infinite radius)). If I wrote something like this, I'd be willing to share the code with the hope that it'd be maintained as Obi is developed.
A global query would probably follow this procedure:
- Test the query condition against the oriented bounding box of each solver. If a given solver passes, then...
- Test the query condition against all occupied cells, OR, in cases where it is possible to determine which cells pass the query condition without enumerating through each cell, get a list of cells that pass the query condition. If a given cell passes, then...
- Test the query condition against all simplexes occupying the cell.
- For each simplex that passes the query condition, modify the query result.
- In the case of a Raycast, replace the current hit point if its distance from the ray is closer.
- In the case of a RaycastAll, add the hit point to the list of hit points.
- In the case of a Checksphere (which returns true if any object occupies a spherical volume, otherwise false), terminate the query and return "true" as the query result if and when a simplex passes the query condition, otherwise false. (A similar test could be done on the cell/solver bounding box itself if it is fully contained within the Checksphere volume.)
A solver specific query would be similar, sans step 1.
I'm guessing that it'd be wasteful to redo all of the work involved in calculating queries like these, given that collision tests between line simplexes and other types are already possible. (A line simplex can be treated like a raycast or a spherecast, with minor modifications.)
|
|
|
How does one disable "phase" based collision masking? |
Posted by: Hatchling - 15-05-2021, 01:57 AM - Forum: Obi Rope
- Replies (6)
|
|
I'd like to ensure that, in my project, everything is able to collide with everything else. However, each time I instantiate a rope, it has the same phase as the last rope I instantiated.
I'd like to disable this feature, as going in and editing each rope I instantiate to have a unique phase seems like it'd be a real pain.
Is there a way to do this? Or would I need to modify source code I don't have access to (e.g. in the DLL)?
EDIT: It appears that using self-collision doesn't just allow collision with the self, but also allows collision between *everything else* of the same phase, *except* rigidbodies, which mostly solves the problem: Just make sure everything has "Self Collision" enabled and that every particle actor uses phase 1, and every rigidbody uses phase 0.
The description is a bit misleading. (Also, as a side note, the term "phase" doesn't evoke the concept of collision. Usually phase is used to describe something's progress through a cycle, like rotation. Perhaps "layer" would be a better term.)
|
|
|
softBody velocity |
Posted by: ReaperQc - 14-05-2021, 02:17 AM - Forum: Obi Softbody
- Replies (5)
|
|
Hi, I am trying to get access to the velocity of my softbody because i can switch between multiple character with different controls. some use rigidbody and one use the softbody, when i switch from the rigidbody to the softbody, i can apply a force to the softbody that is the same as the last velocity of my rigidbody before switching, but when i try to switch from the softbody to a rigidbody, i would like to get the last velocity of my softbody and apply it to the rigidbody's velocity, but unfortunately,I am unsure where to access the softbody's velocity, i was able to find the solver's velocities but it return an unusable vector4 that is only usable with obi element.
|
|
|
|