I need to find the last point of rope in script, not the particles(because when moving the rope, particles seems to be bit late to reach the rope rendered position.
I know this is basic ques, I have searched everywhere, I couldnt get what i need.
15-11-2021, 08:40 AM (This post was last modified: 15-11-2021, 08:41 AM by josemendez.)
(15-11-2021, 07:36 AM)srid96 Wrote: Hi,
I need to find the last point of rope in script, not the particles(because when moving the rope, particles seems to be bit late to reach the rope rendered position.
I know this is basic ques, I have searched everywhere, I couldnt get what i need.
If the solver's interpolation mode is set to "interpolate", solver.renderablePositions will contain temporally smoothed-out positions that won´t coincide with the actual particle positions at the end of the simulation step. That's why they are called "renderable": they are only used for smooth rendering, but they aren't fed back into the simulation.
15-11-2021, 09:21 AM (This post was last modified: 15-11-2021, 09:22 AM by josemendez.)
(15-11-2021, 09:08 AM)srid96 Wrote: can you help me on how to get the last point on rope?
The manual explains how to get the position of any particle in the actor. The last one (or the first one, the 3rd one) is no different from any other. Instead of iterating trough all particles in the actor.solverIndices array, get the last one:
Code:
var lastPos = solver.renderablePositions[actor.solverIndices[actor.solverIndices.Length-1]];
Keep in mind that if you're tearing or resizing your rope at runtime, you will need to use rope elements to consistently get the last particle (as it will change at runtime). See the API docs for more info.
(15-11-2021, 09:21 AM)josemendez Wrote: The manual explains how to get the position of any particle in the actor. The last one (or the first one, the 3rd one) is no different from any other. Instead of iterating trough all particles in the actor.solverIndices array, get the last one:
Code:
var lastPos = solver.renderablePositions[actor.solverIndices[actor.solverIndices.Length-1]];
Keep in mind that if you're tearing or resizing your rope at runtime, you will need to use rope elements to consistently get the last particle (as it will change at runtime). See the API docs for more info.
I did this, but my position seems to be somewhere other than end of the rope. I have attached for your reference. Let me know how to fix this.
Thank you.
(15-11-2021, 03:35 PM)srid96 Wrote: I did this, but my position seems to be somewhere other than end of the rope. I have attached for your reference. Let me know how to fix this.
Thank you.
Quote:All spatial properties (positions, orientations, velocities, vorticities, etc) are expressed in the solver's local space.
However you're assigning your position to transform.position, which is expressed in world space. If you want to use it this way, you need to convert the particle position to world space first, using Unity's TransformPoint(): https://docs.unity3d.com/ScriptReference...Point.html
However you're assigning your position to transform.position, which is expressed in world space. If you want to use it this way, you need to convert the particle position to world space first, using Unity's TransformPoint(): https://docs.unity3d.com/ScriptReference...Point.html
Hi, transforming to world space did not put the object to the last point on rope. Is there anything else am I missing from the attachments?
I also tried particle attachment of an object at the end of the rope (like in chains demo), i'm curious how that chainball moves smoothly and having mass of 5 units didnt jitter/dance where in my case i have to bring the mass to the lowest value to stop jittering and when moving rope , object is not moving smoothly like the chainball.
See the imgs below for particle attachments
16-11-2021, 08:39 AM (This post was last modified: 16-11-2021, 08:41 AM by josemendez.)
(16-11-2021, 08:30 AM)srid96 Wrote: Hi, transforming to world space did not put the object to the last point on rope. Is there anything else am I missing from the attachments?
It should. That's all there is to it, transforming from solver to world space will give you the particle position in world space. Can you share the code you wrote to do this?
(16-11-2021, 08:30 AM)srid96 Wrote: I also tried particle attachment of an object at the end of the rope (like in chains demo), i'm curious how that chainball moves smoothly and having mass of 5 units didnt jitter/dance where in my case i have to bring the mass to the lowest value to stop jittering and when moving rope , object is not moving smoothly like the chainball.
Mass is not the issue here, Obi is unconditionally stable so any jittering indicates a setup problem: probably your object is colliding with the rope. The object cannot be simultaneously inside and outside the rope (which is what the attachment and collisions want, respectively) so it "dances" between both configurations. If the rope needs to be attached inside of or very close to the object, simply disable collisions between the end of the rope and the collider. You can use filters for this.