Can a "touch joint" be used like an elastic "rope" between two objects?

My next undertaking is experimenting with some physics bodies/joints. Here’s the description for a touch joint:
“This connection is an elastic joint with specifiable strength and behavior, but since it is impossible to apply infinite forces to the simulation, the dragged object may “lag behind” a rapidly moving touch.”

Can I use this as a basic “elastic rope” between two objects? For example, one object is “Dog_Walker” and the other is “Dog”. I want to tie these two objects together with a flexible leash, basically. When the Dog_Walker moves around the screen, the Dog object trails behind it via the leash. It’s important that the Dog eventually “catches up” with the Dog_Walker, eventually overlapping Dog_Walker if it stops. Of course, the entire scenario won’t work unless I can make the two objects immune from each other in physics (Dog doesn’t actually collide/bounce with Dog_Walker, it’s just leashed to it).

My reason for this functionality is this: in Torque2D, I found this method very effective for creating smooth, fluid motion of an object. In practice, the Dog_Walker is actually an invisible object. When the user touches the screen, the Dog_Walker moves toward that point. What this does to “Dog”, in effect, is make its motion smooth and gradual… if the leading object (Dog_Walker) suddenly turns 90 degrees or even 180 degrees, the following object (Dog) doesn’t make the same abrupt motion… instead, it flows smoothly toward the leading object because of the elastic nature of the joint. It also provides a nice automatic speed-up and slow-down of the Dog, again based on the principle of the elasticity. Since the user doesn’t actually see Dog_Walker on the screen, it makes Dog behave smoothly like a vehicle might behave, accelerating and decelerating naturally.

So is a “touch joint” a possible solution to this?

Thanks!
Brent

[import]uid: 9747 topic_id: 2653 reply_id: 302653[/import]

OK, I’m an idiot :slight_smile: … I answered my own question by reading further into documentation:

myJoint:setTarget( targetX, targetY )

“While the updated (targetX, targetY) values will normally come from a touch, any values can be passed. For example, the object could be made to follow another object, or track the points of a path.”

So the answer is yes , two objects can be linked via an imaginary elastic rope using a touch joint.

Hopefully the above scenario (initial post) is useful to some people. In Torque2D I found it to be a very slick method for smooth movement, including flying objects like planes, or even tanks in a top-view tank game.
[import]uid: 9747 topic_id: 2653 reply_id: 7664[/import]

Interesting info. I haven’t played with Joints yet. Just have been playing with " Cut the rope" and they seem to have a great model, but they stated that they did not use Box 2D and wrote their own. Dunno exactly why. [import]uid: 8192 topic_id: 2653 reply_id: 8185[/import]

Just a personal update to my own post, after some experimentation…

It’s actually the Distance Joint that can function like an elastic band between two objects. You can define it as “elastic” or “fixed length” depending on your needs. Keep in mind, this is for joining two objects… if you simply want the user’s touch location to function as a drag point with an imaginary elastic rope attached to some object, then you should use a Touch Joint , not a distance joint.

To summarize again, a “Distance Joint” is to join two objects that remain on the screen. A “Touch Joint” is to link one object to the user’s touch, presumably destroying the joint when the user stops the motion.

Brent
[import]uid: 9747 topic_id: 2653 reply_id: 8200[/import]

Aahh, someone working on the next app store hit? [import]uid: 5712 topic_id: 2653 reply_id: 8220[/import]

Aren’t we all? [import]uid: 10248 topic_id: 2653 reply_id: 8409[/import]

Yip, was just thinking about the game play of current no.1 :slight_smile: [import]uid: 5712 topic_id: 2653 reply_id: 8411[/import]

I’m guessing they have written their own one so as to have a little bit more control over how things move. It would be needed for a game like cut the rope as opposed to a pure physics engine. Play a level and watch things move. they are not as free moving as it would seem at first to me.

[import]uid: 9950 topic_id: 2653 reply_id: 8435[/import]

Hello,

I must say I allways have ‘elastic joints’ by default, even using distance joints : objects seems to be linked by springs, and their distance can be far from the wanted distance…

Has anybody here succeded in having a absolutely fixed distance joint, as described here as a fixed length ‘distance joint’ ? I’ve played with damping, length, frequency parameters, with no success.

Any help is welcome. Thanks.

Olivier. [import]uid: 9079 topic_id: 2653 reply_id: 9948[/import]

Hi Olivier,

Did you try using a “Pivot Joint” instead of Distance Joint? This might be the solution to keep two objects attached via a fixed distance. I’m sure there must be a joint of this type in Box2D (Corona’s physics model)… Box2D is too widely-used to omit such a basic joint type. :slight_smile:
[import]uid: 9747 topic_id: 2653 reply_id: 10000[/import]

Hey y’all,
so now that I’m getting a bit deeper on the samples, I’m wondering how to do this: http://gamesalad.com/game/play/38647 (sorry for the GS post).

I already looked/read upon the pivot joint and the distance, but can’t wrap my head as to how this is accomplish.

Any feedback/direction/demos on how to accomplish this would be greatly appreciated.
Thanks,
RD [import]uid: 7856 topic_id: 2653 reply_id: 10333[/import]

How would you go about creating the visible rope itself? [import]uid: 10464 topic_id: 2653 reply_id: 10359[/import]

I’d also like to ask the same question as powmedia.

For example, I am experimenting with making a pendulum right now. So for this, I have two physical objects joined together at a distance via a distance joint.

Physically, the pendulum swings as it should, however, I do not know how to draw the “line” that connects the two physical objects.

In hybrid mode, I can see the line in its physical representation, but is there a way to actually draw it on the screen?

Thanks! [import]uid: 50911 topic_id: 2653 reply_id: 31065[/import]

hi

I am developing a game in which i wanted to use elastic rope to throw the object.

Can anyone please tell me how should i do that??

Hoping for reply soon as i have to complete the project in very less time.

Thanks & Regards
Varun [import]uid: 130269 topic_id: 2653 reply_id: 91638[/import]

Hy IgnisDesign!

May i ask where have you read that you can define distance joint to be elastic or to have fixed distance?

Thanks!

Nick [import]uid: 77183 topic_id: 2653 reply_id: 102959[/import]

found it!
thanks anyway!

Nick [import]uid: 77183 topic_id: 2653 reply_id: 102961[/import]

Pulling up super old thread I know, but I was wondering if anyone knows how to keep the pendulum constantly moving, I notice that after a given amount of time it’s slowing itself down eventually it’ll remain pointed downward and not move anymore. I’m trying to create a pendulum that does not stop swinging and also keeps the same amount of force so like it’ll swing from -90 degrees to 90 and back without losing power on each swing.

Pulling up super old thread I know, but I was wondering if anyone knows how to keep the pendulum constantly moving, I notice that after a given amount of time it’s slowing itself down eventually it’ll remain pointed downward and not move anymore. I’m trying to create a pendulum that does not stop swinging and also keeps the same amount of force so like it’ll swing from -90 degrees to 90 and back without losing power on each swing.