Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Finding last point of rope
#11
(16-11-2021, 08:39 AM)josemendez Wrote: 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?


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.

This issue along with the solution is explained in the manual, at the end of the "pin constraints" section referenced from dynamic attachments:
http://obi.virtualmethodstudio.com/manua...aints.html
Here's my code


Attached Files Thumbnail(s)
   
Reply
#12
You’re doing

Code:
transform.TransformPoint(position);

This doesn’t transform from solver to world space. It transforms from your object’s local space to world space, which is completely incorrect in this case.

It should be:

Code:
solver.TransformPoint(position);

You seem to be unfamiliar with vector spaces. This is a basic concept upon which all 3D game engines -including, but not limited to Unity- are built, and required to be able to use Obi at all. I’d recommend learning about them, otherwise your experience using Obi (and making games, in general) will be a painfully frustrating one.
Reply
#13
Sorry, I understood my wrong code. I do know about vector spaces, I am not that expert but I'm LEARNING.

Also your code appears to be wrong too, solver doesn't have definition for TransformPoint.

Can you help me how to bring "pos" (solver's local space variable from code) to world, I know this is basic(as I mentioned in first post), I am trying to learn so next time when i use your rope, I'd be more familiar. 

Thank you
Reply
#14
(16-11-2021, 10:39 AM)srid96 Wrote: Also your code appears to be wrong too, solver doesn't have definition for TransformPoint.

"solver" should be the solver's Transform component ofc, only transforms have a TransformPoint method. I didn't see that in your code you already have declared a "solver" variable of type ObiSolver, so you can just do:

Code:
solver.transform.TransformPoint(pos);

Quote:I do know about vector spaces, I am not that expert but I'm LEARNING.

No worries, learning is a process. The point I wanted to get across is that using an advanced physics engine to learn the basics is a bit like learning to drive in a F1 car: it will make things unnecessarily complicated for you. Learning anything is easier if you start from simple stuff.

It's fine though if you have time/patience! good luck and don't hesitate to ask if you need help, I'll do my best. Sonrisa
Reply
#15
I have all the patience Sonrisa

I also did that code before you replied, my object positions to the obi rope (gameobject) position, not the end of rope.
Reply
#16
(16-11-2021, 10:57 AM)srid96 Wrote: I also did that code before you replied, my object positions to the obi rope (gameobject) position, not the end of rope.

Maybe your rope's end is actually your rope's start ?

It depends on how you've placed the control points, or if you've rotated the rope. Try the first particle instead:

Code:
var lastPos = solver.renderablePositions[actor.solverIndices[0]];

Also, make sure the object that has this script is not a parent of either the solver or the rope. If it is, moving the object will also move the rope (because of parenting), so you won't ever be capable of placing the object at the rope's end: as soon as you move the object, the rope moves too! It's like a cat-and-mouse chasing game.

I mention this because you're using GetComponentInChildren() to get the solver and rope references... It's fine if the bomb is not "this" object though.
Reply
#17
No, first and last point of rope are not the obi rope gameobject's position.

I did your code, i found out that first point of rope worked well, moving the rope also moves the object to the first point pos smoothly.


Is the code for last point correct?

actor.solverIndices[actor.solverIndices.Length - 1]
Reply
#18
(16-11-2021, 11:18 AM)srid96 Wrote: Is the code for last point correct?
actor.solverIndices[actor.solverIndices.Length - 1]

It is correct, as long as you don't have any pooled particles.

Ropes create a pool of auxiliary particles in case you want to resize or cut the rope. (see:http://obi.virtualmethodstudio.com/manual/6.2/ropesetup.html) Check that in your blueprint, the pool size is zero. If it isn't, the last particle in the solverIndices array will be one in the pool, not one in the rope.

For a non-zero pool size (that is, a resizable/cuttable rope), you must use elements as mentioned previously in this thread. Elements are the "edges" in between particles, they join 2 particles each. The last particle in the rope will then be the second particle of the last element:

Code:
var lastPos = solver.renderablePositions[rope.elements[rope.elements.Count-1].particle2];
Reply
#19
Ok, I didn't know about this...you are a LEGEND!!

Thanks for everything, instant reply to every message i posted. HATS OFF!!
Reply
#20
(16-11-2021, 11:42 AM)srid96 Wrote: Ok, I didn't know about this...you are a LEGEND!!

Thanks for everything, instant reply to every message i posted. HATS OFF!!

You're welcome! Sonrisa Let me know whenever I can be of help.
Reply