01-10-2021, 07:58 AM
(This post was last modified: 01-10-2021, 08:02 AM by josemendez.)
(01-10-2021, 06:32 AM)lacasrac Wrote: What is the best way to get the rope swing speed, velocity?
Deformable objects in general (this includes ropes) do not have a single speed or velocity. Where would you measure it? Different parts of the object can move at different speeds in different directions.
For deformable objects, you have two options: calculate some kind of average of all velocities in the object, or measure the velocity of a single point in the object.
Obi allows you to read/write any per-particle property: positions, velocities, mass, etc. So for the first option, the velocity of the object's center of mass (mass-weighted average of all particle positions) is often a good choice. For the second, just pick a particle of your choice and read its velocity back.
The manual contains sample snippets to calculate the center of mass, and to read the velocity of each individual particle:
http://obi.virtualmethodstudio.com/manua...icles.html
Quote:Also get an angle of two particle?
Two points in space do not define an angle, unless you mean their rotation with respect the XZ plane or some other fixed reference orientation. You need at least 3 points to have angles in there. Then, it is a matter of just getting the vectors between them and using Vector3.Angle()
You can get the particle positions using the particles API, see the same link above:
http://obi.virtualmethodstudio.com/manua...icles.html