As you can see, the height of the Platform 1 will be 5m or anything like that, and it will be taller than Platform 2 whose height could be 2.5, just shorter than the first platform. There will be two poles standing on top of each platform respectively. And there will be one rope or line connecting each pole vertically or diagonally. Creating these objects is not a big deal, I can create them using sprites. Again, there will be one cloth object attached to the first pole on top of Platform 1. It will be at a certain height to that of the player so that the player will have to jump to hold that cloth object.
Now, whenever the object grabs the cloth attached to the rope, it should slide down way to Platform 2 and land there. The cloth object should slide along the path of the rope without making the player fall down. How can I achieve this?
One possible way is to check for collision between player and handle, then activate physics behaviour on the player (turn off platform behaviour if it has it) and add a weld joint between the player and the handle.
Thanks for the reply. I did this setup and it is working perfectly, except for one part. When the physics behavior activates on collision with the player for the handle, the handle is falling down a certain distance instead of directly sliding across the diagonal rope along with the wheel. I don’t want it to fall down when it collides with the player. So what could be the possible reason and how can I fix this? Also, when the player reaches the other point, it is slightly titled or rotated. How can I fix these issues?
Instead of setting the wheel as static object initially, I decided to reactive the physics at the start of the scene because the static was not switching to dynamic during. So, I had to use this alternative.
when I mean it’s falling down in the above reply, I don’t mean that the wheel joint is not working. I mean that it is slightly going down before it starts to slide, meaning just a few distances down, not completely gone down.
Now, I got another problem. When the player collides with the handle (ZiplineCloth), only the wheel is sliding down, but the handle and player are freezing at their initial position. The rope is a straight line titled at an angle of 20 degrees.
For the handle (zipline cloth) 80x100px:
Gravity Scale: 0
Linear Damping: 0.1
Angular Damping: 1
Layer & Masks: No
For the wheel 64x64px:
Gravity Scale: 1
Linear Damping: 0.1
Angular Damping: 1
Layer & Masks: 1
I’ve been tweaking these settings for hours and still couldn’t get the desired results. Sometimes the rabbit is flying, sometimes the handle is flying, and sometimes they are sliding all the way back to the left while they should be sliding towards the right where the rope is inclined at. This is my actual scene setup.
I agree. It might me fun to create the simulation but unless the games main focus is physics or ziplining, it doesn’t need to be that accurate. The player probably won’t notice or appreciate the extra attention to details especially if the mechanics don’t work flawlessly. Tweens are simple, reliable, consistent and require fewer resources.
Nice solution. Thanks for sharing it. It goes to show that it doesn’t matter how it’s done, as long as it looks right.
May I suggest you use a target object for the wheel to travel to, and tween to that object’s position. That way if you move the line, you move the target object too and you don’t have to ferret through the events to update the target co-ordinates.
Tweens are indeed a great way to “fake” physics. I did a similar method of tweens on a rocket launching up and slamming down.
If you wanted to mess with physics more, I would recommend a prismatic joint on the cloth. Then set the “Axis angle” to be the angle of the zipline. Keep in mind that the speed of the zipline will now change based on the steepness of the angle (which is realistic) but in your game you might want a controllable speed (which the tweens can provide).