Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Climbing on rope and fix to move only on x, y
#10
(05-10-2021, 09:26 PM)lacasrac Wrote: So basically this the first and last particle index of a rope?

Almost. Last one should be:
private int GetLastParticleIndex() => _rope.elements[_rope.elements.Count - 1].particle2;

Look at this (terrible) diagram: "O" is a particle, "-----" is an element:

O-----O-----O-----O-----O

Each element references two particles: the second particle of element N is the first particle of element N+1.
The first particle of the first element is the first particle in the rope, and the second particle of the last element is the last particle in the rope. Like this:

(O)-----O                       O-----(O)


(05-10-2021, 09:26 PM)lacasrac Wrote: Can you help me how to improve? Now it is very ugly Gran sonrisa
I want something like in the Inside game... So basically if the player's foot collide with a particle then the particle attach to the player's foot and that elements between the hands + feet now moving just stay straight somehow. I tried adding to that colliding particle a fixed position but I don't know how to to that.

You could just fix the particles in place (by setting their inverse mass to zero, see the manual): http://obi.virtualmethodstudio.com/manua...icles.html) and then just set their positions to whatever you need.

(05-10-2021, 09:26 PM)lacasrac Wrote: Also I noticed that the positions is not the ral world positions, so I added the solver's transform position to it, to get the world position.

Yes, solver data is not expressed in world space. All particle data is expressed in the solver's local space. This is indicated throughout the manual:
http://obi.virtualmethodstudio.com/manua...olver.html

Quote:Solvers always perform the simulation in local space.

http://obi.virtualmethodstudio.com/manua...icles.html

Quote:All spatial particle properties (positions, orientations, velocities, vorticities, etc) are expressed in the solver's local space.

If you want your data expressed in world space instead you need to transform it. Unity contains functions to do just that (TransformPoint, TransformVector, TransformDirection).

If you're unfamiliar with the concept of vector spaces, they're used extensively in game making (both 2D and 3D) so better get used to them! Guiño

(05-10-2021, 09:26 PM)lacasrac Wrote: +1: What is the Vector4 w value? Is it a big probelem is I just add a "0" to it?

Quoting the manual:
http://obi.virtualmethodstudio.com/manua...icles.html

Quote:Dimensional data in Obi (such as positions and velocities) has 4 components (x,y,z,w) instead of the usual 3 (x,y,z). This is for efficiency reasons (memory alignment). You can safely ignore the fourth component in these, casting Vector4 to Vector3 whenever necessary.

So the fourth component is there to ensure 16 byte memory alignment for SIMD. It should always be zero.
Reply


Messages In This Thread
RE: Climbing on rope and fix to move only on x, y - by josemendez - 06-10-2021, 08:19 AM