|
|
Is there a way to query collisions with Obi Bone? |
Posted by: spikebor - 06-05-2024, 12:00 PM - Forum: Obi Rope
- Replies (5)
|
|
I want to detect collisions with this character (which has nothing on him other than Obi bone)
Can it be done, or he should have Collider? I think Obi Bone or not, it has particles under it as all Obi things, so I can query its collisions with my character (my character has Obi Collider)
I want to debug the impulse.
The Golem can contact and push my character back, but this code (subscribed to character's solver.OnCollision event) returns no collisions.
Code: void Solver_OnCollision(object sender, ObiSolver.ObiCollisionEventArgs e)
{
foreach (Oni.Contact contact in e.contacts)
{
collisionsImpulse += contact.normalImpulse;
}
}
Even though I enable Collision and Particle Collision collision / Queries on my character.
|
|
|
Advection but for a mesh. |
Posted by: spikebor - 03-05-2024, 09:28 AM - Forum: Obi Fluid
- Replies (2)
|
|
I'm thinking about this idea for a while.
We got:
-Obi Fluid which is limited in particle count, making something like a pool will be hard on the GPU.
-Obi fluid can advect things near it, like shuriken particles.
So why can't we apply the same advection idea, but instead of shurikens, we apply it to the nearby mesh vertex?
So the idea is we have a pool of Obi fluid particles, which having very large particle scale, and not rendered.
With this we can have any object that jump into the pool will be physics collide and have buoyancy force to pull it up but with low particle count.
And on top we have a plane mesh for the surface, which advected by the Obi Fluid. This way the mesh can have deformation, this mesh can be Fluxy mesh which have 2.5D sim on top to give us detailed waves simulation, while the Obi Fuild give it bigger wave advection.
Isn't this a best of both world? You can make a bridge asset that have 2 requirements that are Fluxy and Obi Fluid. If you can add underwater rendering for it, it will sell like hot cakes.
|
|
|
Obi Fluid 6 not render on Window build |
Posted by: spikebor - 02-05-2024, 05:07 PM - Forum: Obi Fluid
- Replies (3)
|
|
Hi, I have this bug when test build on PC Window the Obi Fluid
Obi Fluid 6.5.4, works well on Editor using the Obi/URP/Particles.shader, but not work on PC build (x64 window).
Unity URP 2022.3.16f1
Do I miss any setup step?
Log:
Code: Particle rendering shader not suported.
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogWarning(Object)
Obi.ObiParticleRenderer:CreateMaterialIfNeeded()
Obi.ObiParticleRenderer:DrawParticles(ObiActor)
Obi.ObiActor:Interpolate()
Obi.ObiSolver:Interpolate(Single, Single)
Obi.ObiUpdater:Interpolate(Single, Single)
Obi.ObiFixedUpdater:Update()
--Stack Trace--
Obi Fluid Renderer not supported in this platform.
UnityEngine.Debug:LogWarning(Object)
Obi.ObiFluidRendererFeature:AddRenderPasses(ScriptableRenderer, RenderingData&)
UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal(RenderPipelineAsset, IntPtr, Object)
|
|
|
I've made a bounce script, but don't know how to optimize |
Posted by: spikebor - 01-05-2024, 12:35 PM - Forum: Obi Softbody
- Replies (3)
|
|
Hi, the idea is simple, to improve the game feel when character make contact with the softbody.
I would like to have softbody handle OnContact by iterate the contacts and add the incoming contact impulse with a mult value,
so that we can have a squashed feel when character step on a slime.
When it works, it is very cool to look at !
But eventually it can be very easy to spiral into a dead performance degradation, since each time you got contact, you have to iterate the contacts, and then iterate the particles to detect which particle is near to add the bounce force.
For example: 10 contact, 1000 particles, that is 10000 iterations each time we got contact. Wow!
How can I optimize this?
Code: using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;
using Unity.Mathematics;
namespace SPIKE.kIntegration
{
//when got some contact, be squashed by that contact in normal direction
[RequireComponent(typeof(ObiActor))]
public class ObiBouncer : MonoBehaviour
{
[SerializeField] ObiSolver _solver;
[SerializeField] float _propagate = 0.5f, _bounceForceMult = 10,_clampBounceForce=10;
[SerializeField] bool _debug;
ObiActor actor;
void Awake()
{
actor = GetComponent<ObiActor>();
}
void OnEnable()
{
_solver.OnCollision += Solver_OnCollision;
}
void OnDisable()
{
_solver.OnCollision -= Solver_OnCollision;
}
void Solver_OnCollision(object sender, ObiSolver.ObiCollisionEventArgs e)
{
var world = ObiColliderWorld.GetInstance();
// just 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)
{
Vector3 contactOnCollider = contact.pointB;
contactOnCollider = _solver.transform.TransformPoint(contactOnCollider);
Vector3 contactNm = contact.normal;
#if UNITY_EDITOR
if (_debug)
{
Debug.DrawLine(contactOnCollider, contactOnCollider + contactNm, Color.yellow, 2f);
}
#endif
//iterate the particles
for (int i = 0; i < actor.solverIndices.Length; ++i)
{
int solverIndex = actor.solverIndices[i];
//add bounce force based on the propagate distance
if (Vector3.Distance(actor.GetParticlePosition(solverIndex), contactOnCollider)
< _propagate)
{
var squashForce = contact.normal * math.min( contact.normalImpulse * _bounceForceMult,_clampBounceForce);
actor.solver.velocities[solverIndex] += squashForce;
}
}
}
}
}
}
}
|
|
|
Prefab Creation & Cable Length with Rigidbodies |
Posted by: Sky d - 01-05-2024, 10:21 AM - Forum: Obi Rope
- Replies (5)
|
|
Hello. I'm creating audio cables with physics and connectors for my XR project. Thanks for the amazing tool.
I have 2 questions.
1. I already attached my rigidbodies on each end of the rope, but now I realize I need to make the rope longer. How can I do that without needing to reposition and attach the precisely placed rigidbody cable connectors?
2. After I make my master cable which has the two connectors, how can I safely create a prefab that I can re-use over and over? The cables I'm making also have custom snap functions that connect them to other gameobjects, so it's important that both ends are able to be freely manipulated by the player in VR. The goal here is to have different length & color coded prefab cables for the player to use. With each level, I hope to be able to just drop them in the heirachy going forward.
|
|
|
|