|
|
Check for collision of last particle in rope |
Posted by: docgonzzo - 23-12-2022, 01:43 AM - Forum: Obi Rope
- Replies (1)
|
 |
Hi again,
I need a way to check if the last particle in the rope (i.e. end of the rope) has collided with an object.
I understand the last point in the rope can be obtained by elements but I'm not sure how to check for the actual particle.
If that last particle hits an object I need to assign that object as an ObiParticleAttachment.target.
Here's what I have so far.. any hints? Hoping to get this figured out before the holidays
Code: void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
var world = ObiColliderWorld.GetInstance();
//iterate over all contacts in the current frame:
foreach (Oni.Contact contact in e.contacts)
{
// if this one is an actual collision:
if (contact.distance < 0.01)
{
ObiColliderBase col = world.colliderHandles[contact.bodyB].owner;
if (col != null)
{
if (col.gameObject.layer == 15)
{
//if we are here we know particles are colliding with layer 15 objects.
//how can I know if it's the LAST PARTICLE in the rope (end of the rope) that has touched the debris?
//I know this is supposed to return the position/point of the last particle..
Vector4 lastPoint = solver.positions[rope.elements[rope.elements.Count - 1].particle2];
}
}
}
}
}
|
|
|
Cloth Jumps at Start |
Posted by: brootas - 22-12-2022, 04:01 AM - Forum: Obi Cloth
- Replies (5)
|
 |
Hello!
When I hit play to simulate, the cloth jumps the moment it starts playing. It starts it out at an incorrect spot.
I followed the steps from the 'ObiCloth en capa' video.
What could I do to prevent the jumping?
Thank you!
|
|
|
Obi rope collision stops working after loading scene |
Posted by: Zombie1111 - 22-12-2022, 12:53 AM - Forum: Obi Rope
- Replies (2)
|
 |
Hi, this is what I do...
I have a rope in Scene A.
Then I put that rope in DontDestroyOnLoad.
Then I load scene B.
After I have done that the rope does not collide with any obi collider in scene B! Opening the ropes path editor and changing something then closing it fixes the issue.
Enabling and disabling the rope also fixes the issue but sometimes completely breaks the rope so it aint reliable at all.
So I guess there is a function that I need to call after the scene has finished loading to like update all obi colliders. But I dont know what the function is called.
I have tried [solver].updateBackend
|
|
|
IndexOutOfRangeException |
Posted by: SimonP - 21-12-2022, 11:26 PM - Forum: Obi Softbody
- Replies (3)
|
 |
Hello! I just bought the asset. When I try to add the skeleton in the blueprint it gives me this error.
If I generate it without skeleton it works fine.
Any suggestions?
P/d: Unity 2021.3.9f clean project
IndexOutOfRangeException: Index was outside the bounds of the array.
Obi.GraphColoring.AddConstraint (System.Int32[] particles) (at Assets/Obi/Scripts/Common/Blueprints/GraphColoring.cs:44)
Obi.ObiSoftbodySurfaceBlueprint+<CreateClustersFromSkeleton>d__51.MoveNext () (at Assets/Obi/Scripts/Softbody/Actors/ObiSoftbodySurfaceBlueprint.cs:618)
Obi.ObiSoftbodySurfaceBlueprint+<Initialize>d__37.MoveNext () (at Assets/Obi/Scripts/Softbody/Actors/ObiSoftbodySurfaceBlueprint.cs:215)
Obi.ObiActorBlueprint+<Generate>d__59.MoveNext () (at Assets/Obi/Scripts/Common/Blueprints/ObiActorBlueprint.cs:282)
Obi.CoroutineJob+<Start>d__15.MoveNext () (at Assets/Obi/Scripts/Common/Utils/Coroutines/CoroutineJob.cs:99)
UnityEngine.Debug:LogException(Exception)
Obi.<Start>d__15:MoveNext() (at Assets/Obi/Scripts/Common/Utils/Coroutines/CoroutineJob.cs:108)
Obi.EditorCoroutine:ShowCoroutineProgressBar(String, IEnumerator&) (at Assets/Obi/Scripts/Common/Utils/Coroutines/EditorCoroutine.cs:21)
Obi.ObiActorBlueprintEditor:Generate() (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:131)
Obi.ObiActorBlueprintEditor:OnInspectorGUI() (at Assets/Obi/Editor/Common/Blueprints/ObiActorBlueprintEditor.cs:163)
UnityEngine.GUIUtility rocessEvent(Int32, IntPtr, Boolean&)
|
|
|
Odd collision detection behaviour for objects at non 90 degree angle |
Posted by: Moon_Hermit - 20-12-2022, 06:34 PM - Forum: Obi Softbody
- Replies (2)
|
 |
Hello
I'm trying to use a script to detect when the gameobject the player gameobject has collided with and then run another line of code once detected.
The issue I am having is the player detects the other gameobject without physically touching it if the other gameobject is rotated at an angle that is not a multiple of 90. What seems to be happening is the other gameobject has an area around it with a rotation of 0-degrees. When the player enters this area it detects the other gameobject. In the screenshot below the white cube is the object I want to detect rotated to a 45-degree angle and the red cube is the area the player is detecting rotated 0-degrees.
I've also included a screenshot of the white cube's collider setup.
I want to fix this issue so the player only detects the other gameobject when physically colliding with it.
I'm not an experienced programmer and am at a loss for what to do so any help would be greatly appreciated.
Thank you.
Below is the code I'm using to detect the object the player is colliding with.
Code: private void Solver_OnCollision(ObiSolver solver, ObiSolver.ObiCollisionEventArgs e)
{
foreach (Oni.Contact contact in e.contacts)
{
ObiColliderBase collider = ObiColliderWorld.GetInstance().colliderHandles[contact.bodyB].owner;
print(collider.transform.gameObject);
|
|
|
Overwriting Particles As Capacity Reached |
Posted by: mapleleaf4evr - 18-12-2022, 02:04 AM - Forum: Obi Fluid
- Replies (1)
|
 |
Hi there,
I am trying to implement a use of Obi Fluid where bleeding is simulated and remains on the ground. I would like to use an emitter that continually emits particles even once the particle limit (capacity) for the blueprint is reached. I only want particles to be destroyed/recycled after the maximum amount of particles have been spawned so that there is a continuous emission. Once the emission stops, I would like the particles that have already been spawned and are sitting on the floor to remain there indefinitely or as long as possible.
Basically I don't want the particles to die until particle capacity is reached and then I only want them to die at a rate that is needed to continue emission.
From reading through these forums, I think this would be possible through emitter.KillParticle and setting lifespan to infinity. Is this the correct/most performance efficient way to implement this? I'm imagining that I would just write a script that checks if the number of particles is nearing max capacity and then starts to kill the oldest particles at the same rate they are being emitted. Can this just go in any old Update() function or is there a better place to put it?
Thank you
|
|
|
|