Search Forums

(Advanced Search)

Latest Threads
Stretching verts uniforml...
Forum: Obi Softbody
Last Post: Aroosh
Today, 05:32 AM
» Replies: 0
» Views: 43
Scripting rod forces
Forum: Obi Rope
Last Post: chenji
11-09-2025, 01:15 PM
» Replies: 25
» Views: 2,540
Burst error causing crash...
Forum: Obi Rope
Last Post: josemendez
10-09-2025, 07:03 AM
» Replies: 1
» Views: 163
Controlling speed of emit...
Forum: Obi Fluid
Last Post: josemendez
06-09-2025, 06:29 AM
» Replies: 1
» Views: 408
Looks nice on editor but ...
Forum: Obi Fluid
Last Post: josemendez
04-09-2025, 07:20 AM
» Replies: 3
» Views: 664
How to Shorten or Scale t...
Forum: Obi Rope
Last Post: josemendez
02-09-2025, 09:53 AM
» Replies: 5
» Views: 757
The Limitation of Using O...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 10:30 PM
» Replies: 1
» Views: 498
Bug Where a Straight Segm...
Forum: Obi Rope
Last Post: josemendez
01-09-2025, 08:46 PM
» Replies: 1
» Views: 475
Having an issue with obi ...
Forum: Obi Rope
Last Post: Ben_bionic
29-08-2025, 04:23 PM
» Replies: 4
» Views: 970
Non-uniform particle dist...
Forum: Obi Rope
Last Post: chenji
29-08-2025, 09:05 AM
» Replies: 4
» Views: 822

 
  Better rope pendulum
Posted by: lacasrac - 04-11-2021, 08:06 AM - Forum: Obi Rope - Replies (1)

Hello again!

https://www.youtube.com/watch?v=Gqkz-JlseRw

I created this pendulum, found that script on the net and refactored it to obi rope.

By the way it looks like very weird. How can I create a more nicer look?

script is here:


public class ObiRopePendulum : MonoBehaviour
{
    [Range(0.3f, 10)] public float moveSpeed = 0.8f;
    [Range(5f, 40)] public float angleScale = 20f;
   
    private float _leftAngle = -10;
    private float _rightAngle = 10;
    private bool _clockwise;
    private CreateObiRope _createObiRope;

    private void Start()
    {
        _createObiRope = GetComponent<CreateObiRope>();
        _clockwise = true;
        _rightAngle = moveSpeed * angleScale;
        _leftAngle = -_rightAngle;
    }

    private void Update() => Move();

    private void Move()
    {
        var angle = _createObiRope.GetSignedRopeAngle();
        if (angle > _rightAngle)
            _clockwise = false;
        if (angle < _leftAngle)
            _clockwise = true;
       
        var speed = !_clockwise ? moveSpeed : -moveSpeed;
        var v = new Vector3(speed, 0, 0);
        _createObiRope.PendulumVelocity(v);
    }
}


and the PendulumVelocity:

public void PendulumVelocity(Vector3 velocity)
{
    /*
    var lpIndex1 = GetFirstParticleIndex();
    var lpIndex2 = GetLastParticleIndex();
    for (var i = lpIndex1; i <= lpIndex2; i++)
    {
        rope.solver.velocities[i] = velocity.ToVector4();     
[/i]
[i]    }*/
    rope.solver.velocities[GetLastParticleIndex()] = velocity.ToVector4();
}[/i]


I want the lamp swinging always left/right but with a physics correct way.

How can I improve it to a better way? It is now not so good at the moment Triste

Print this item

  How easy it is to modify the softbody mesh during runtime?
Posted by: snowtv - 03-11-2021, 07:27 PM - Forum: Obi Softbody - Replies (2)

Lets say I have two cubes A and B, and I want to cut both A and B in half (the cutting plane is not pre-determined but is based on user input), then join half of A and half of B together.

What is the best approach to this kind of scenario?

Print this item

Pregunta Obi Solver OnCollision
Posted by: ProDea - 02-11-2021, 01:34 PM - Forum: Obi Fluid - Replies (4)

Hello everyone,

Is there any way to take particle color of collided fluid on OnCollision event?

Print this item

  Material property changes don't work with ObiCloth
Posted by: timconkling - 01-11-2021, 11:25 PM - Forum: Obi Cloth - Replies (7)

(I'm not sure if this is a bug, or an unsupported feature, or if I'm doing something wrong!)

  • We have a character in our game who wears a gown. The gown uses an Obi SkinnedCloth component for its cloth simulation.
  • If the character takes damage, the gown becomes "bloodied".
  • To do the bloody-gown effect, we're animating a property on its Material instance; a shader uses the property to do some color blending.
This all works properly when we use Unity cloth:

   

But when we use Obi cloth, changes to the gown Material's properties don't do anything:

   

(If we change the *master* Material's properties, we *can* get the bloody-gown effect to work with Obi - but of course, that means that all gowns share the "bloody" status.)

Why is this happening, and is there a way to solve it? Thanks!

Print this item

  How to save rope blueprint?
Posted by: linkinb - 01-11-2021, 12:06 PM - Forum: Obi Rope - Replies (1)

Hi,
I create ropes via script using the RopeBetweenTwoPoints.cs sample script.

Once the rope is generated, I want to be able to edit the blueprint to my liking and save the blueprint of the rope for future use.
The only problem is the blueprint is created using 
var blueprint = ScriptableObject.CreateInstance<ObiRopeBlueprint>();

Now I can edit the rope in playmode but since the blueprint is an instance it doesn't get saved. 
If I save the rope as a prefab the blueprint still dissapears. 
I know I can manually create blueprints and edit them in the editor, but I intend to create 20+ ropes and it would be tedious to manually create each new rope and blueprint.

How can I save a rope as a prefab/save the rope's blueprint after it has been generated and edited in playmode?

Print this item

  Collision position related to world
Posted by: Hoomann - 01-11-2021, 11:10 AM - Forum: Obi Rope - Replies (1)

Hi there
i just want to know the position of the particle that collides with another gameObject tagged with something.
i have read this page: http://obi.virtualmethodstudio.com/manua...ngcollider
but still couldn't manage to do it.
position variable given from code below doesn't seem to be related to world

// do something with the particle, for instance get its position:
var position = solver.positions[particleIndex];

Print this item

  drag the ball
Posted by: 0hsyn1 - 28-10-2021, 03:04 PM - Forum: Obi Softbody - Replies (4)

Hi, I have Ball(sphere) and it has soft body property. I want to click and drag with the mouse. 
Problem: it breaks down when it moves. 
Code inside top object:


Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


[RequireComponent(typeof(Rigidbody))]
public class BallMove : MonoBehaviour
{
    const float speed = 500f;

    private Vector3 mOffset;
    private float mZCoord;
    private bool active;
    private Rigidbody rb;
    float startRotationY;

    void Awake()
    {
        startRotationY = transform.eulerAngles.y;
    }
    private void Start()
    {

        rb = GetComponent<Rigidbody>();

        Debug.Log(startRotationY);
    }

    private void OnMouseDown()
    {
       
        mZCoord = Camera.main.WorldToScreenPoint(
            gameObject.transform.position).z;
        mOffset = gameObject.transform.position - GetMouseAsWorldPoint();
        active = true;
        rb.velocity = Vector3.zero;
        rb.useGravity = false;
        rb.constraints -= RigidbodyConstraints.FreezeRotationZ;
    }

    private void OnMouseUp()
    {
        active = false;
        rb.useGravity = true;
        rb.velocity = Vector3.zero;
        rb.constraints &= ~RigidbodyConstraints.FreezeRotationZ;
    }

    private Vector3 GetMouseAsWorldPoint()
    {
        Vector3 mousePoint = Input.mousePosition;
        mousePoint.z = mZCoord;
        return Camera.main.ScreenToWorldPoint(mousePoint);
    }

    private void FixedUpdate()
    {
        if (active)
        {
            Vector3 desiredPosition = GetMouseAsWorldPoint() + mOffset;

            rb.velocity = Vector3.Distance(desiredPosition, rb.position) > 0.1f ? (desiredPosition - rb.position) * Time.fixedDeltaTime * speed : Vector3.zero;
        }
        transform.eulerAngles = new Vector3(0, startRotationY, transform.eulerAngles.z);
    }

    private void Update()
    {
        transform.position = new Vector3(transform.position.x, transform.position.y, 0);
    }
}



Attached Files Thumbnail(s)
           
Print this item

  obi rope generating
Posted by: Hoomann - 28-10-2021, 11:32 AM - Forum: Obi Rope - Replies (4)

hi there..my character runs forward and each time it hits something a rope will be generated connecting from character to it and as you go forward the length should increase.
1- since level length is increasing is there going to be a decrease in performance since you may get multiple ropes and they're all getting longer?
2- when rope is generated for a moment it seems it's initial length is too much for a short distance between character and object, is there a way to shorten initial length of the rope?



Attached Files Thumbnail(s)
   
Print this item

  Attachment not work
Posted by: OsirisDev - 27-10-2021, 04:47 PM - Forum: Obi Cloth - Replies (5)

I have a problem I can't understand the reason, I have 2 cloaks of different types, I added Static groups in both to attach with it to the parent character, it works only in the first case.
https://ibb.co/YyS5WKb

https://ibb.co/6tBL0fP

Print this item

  Add a ragdoll attachment to the rope's end
Posted by: lacasrac - 27-10-2021, 10:46 AM - Forum: Obi Rope - Replies (11)

I have a ragdoll but when I attaching to my rope's end, the ragdoll just falling down.
Can I attach it? How?

I need to my character hanging on the last rope's segment. Basically I want to attach one of his body part to the rope's end.
Let's say: neck, or just the "2 foot" or "2 hand".

Can you help me in this?

Print this item