Obi Official Forum
Help Apply random movement on scene start. - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: Help Apply random movement on scene start. (/thread-2191.html)



Apply random movement on scene start. - arpan018 - 23-04-2020

I have multiple ropes with their respected particle attachment. When scene start i want to show random movement like rope hanging on scene start.


RE: Apply random movement on scene start. - josemendez - 23-04-2020

(23-04-2020, 11:59 AM)arpan018 Wrote: I have multiple ropes with their respected particle attachment. When scene start i want to show random movement like rope hanging on scene start.

There's many ways you can do this, without a more detailed description it's hard to pick the best one. The most basic/easiest one probably being giving a random start rotation to each rope. See:
https://docs.unity3d.com/ScriptReference/Random-rotation.html


RE: Apply random movement on scene start. - arpan018 - 23-04-2020

(23-04-2020, 03:03 PM)josemendez Wrote: There's many ways you can do this, without a more detailed description it's hard to pick the best one. The most basic/easiest one probably being giving a random start rotation to each rope. See:
https://docs.unity3d.com/ScriptReference/Random-rotation.html

My rope is affected by gravity so on start applying rotation wont do anything. How can i apply random force for one frame so it would look like rope done some movement for couple of seconds? would it be with simple rigidbody and force?
edit: i tried that and didnt affect at all upto force in +y direction multiplied by 5000.


RE: Apply random movement on scene start. - josemendez - 23-04-2020

(23-04-2020, 04:09 PM)arpan018 Wrote: My rope is affected by gravity so on start applying rotation wont do anything.

I meant before placing the rope under a solver, after you start the simulation rotation won't do anything indeed. If you start the scene with everything already under a solver it will start simulating immediately.

Using rigidbody.AddForce on a rope won't do anything, as Obi does not use rigidbodies at all, that's the whole point of a particle based engine. You'll need to apply forces to the particles themselves, see:

http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html

So simplest thing you could do is set initial velocities for all particles in each rope.