Hello there. I'm looking for help with coding a rope and rope physics that doesn't use love.physics and that can be attached to 2 objects which cause the rope to be pulled and the object to pull one object in a similar way. I've seen other implementations but does anyone have an implementation that can do this.
The pulling should be realistic(damping? I'm not sure how it works) and also stop when the object being pulled is behind a wall/obstacle.
Fast Rope Physics for bump.lua?
- Gunroar:Cannon()
- Party member
- Posts: 1143
- Joined: Thu Dec 10, 2020 1:57 am
-
- Party member
- Posts: 559
- Joined: Wed Oct 05, 2016 11:53 am
Re: Fast Rope Physics for bump.lua?
You could do this with bump, but I think you'd honestly be better off using love.physics/box2d for any realism. After all, bump.lua's README even says:
However, if you want more gameistic ropes? Sure, bump should work fine. Maybe illustrate an example of what the rope system needs beyond damping.
The first three points are pretty relevant for rope physics, and maybe 4.bump is not a good match for:
- Games that require polygons for the collision detection
- Games that require highly realistic simulations of physics - things "stacking up", "rolling over slides", etc.
- Games that require very fast objects colliding reallistically against each other (in bump, being gameistic, objects are moved and collided one at a time)
- Simulations where the order in which the collisions are resolved isn't known.
However, if you want more gameistic ropes? Sure, bump should work fine. Maybe illustrate an example of what the rope system needs beyond damping.
Re: Fast Rope Physics for bump.lua?
Sound like inverse kinematics
I've made some prototype that look like that: https://twitter.com/4v0v_/status/1334771338020593666
If it look like what you want I can try to find the code.
I've made some prototype that look like that: https://twitter.com/4v0v_/status/1334771338020593666
If it look like what you want I can try to find the code.
Re: Fast Rope Physics for bump.lua?
T2R uses a simple rope, with just 1 segment, to attach the ball; feel free to check the source code (see sig). If you want a more realistic behaviour (catenary effect, for example) then the plot thickens.
- Gunroar:Cannon()
- Party member
- Posts: 1143
- Joined: Thu Dec 10, 2020 1:57 am
Re: Fast Rope Physics for bump.lua?
I kind of just want the object to be dragged by another object, like their in tug of war, but with no extra stuff like yoinking due to gravity.
This seems like it might work, can you find the code?4vZEROv wrote: ↑Sun Mar 14, 2021 6:04 pm Sound like inverse kinematics
I've made some prototype that look like that: https://twitter.com/4v0v_/status/1334771338020593666
If it look like what you want I can try to find the code.
Yes, the plot thickens
Last edited by Gunroar:Cannon() on Mon Mar 15, 2021 7:58 pm, edited 1 time in total.
Re: Fast Rope Physics for bump.lua?
If you want pre-made code you can check this project for example: viewtopic.php?f=5&t=12330
If you want to know what you're doing, I suggest you take a look at this post: viewtopic.php?p=219275#p219275 (maybe you need to read some earlier posts for context).
Basically, a rope can be modelled as a series of springs attached to each other, similar to the image here: https://en.wikipedia.org/wiki/Wave_equa ... ke%27s_law so you would use Hooke's law to adjust the position (for each spring in the rope, correct the position of the mass at the end, by applying a force proportional to the distance difference from the "default"/"relaxed" distance). You need to use Verlet integration and make multiple passes. You also need to apply gravity to each mass for the catenary to form itself.
- Gunroar:Cannon()
- Party member
- Posts: 1143
- Joined: Thu Dec 10, 2020 1:57 am
Re: Fast Rope Physics for bump.lua?
Nice, I'll look into those thoouugh...I really want my rope to be simple, like straight lines that only bend when they go around a corner(so you could say the physics part is when it comes down to other objects pushing each other. That's why I wanted it done in bump .The "rope" should bends only when it goes around a corner.
That's why I found it hard to use the normal algorithms I already found(plus its for top down use, so no gravity)...heheh.
So with this said any new ideas, or can it still be done with the other ropes?
That's why I found it hard to use the normal algorithms I already found(plus its for top down use, so no gravity)...heheh.
So with this said any new ideas, or can it still be done with the other ropes?
Re: Fast Rope Physics for bump.lua?
You could port some Verlet engine into Lua, the rope would consist of several linked segments (like 100 total), each with a distance constraint.
There are tons of live Verlet physics demos online using HTML5:
- https://subprotocol.com/system/tree.html
- https://codepen.io/guerrillacontra/pen/XPZeww
- https://codepen.io/CLMcCorkle/pen/vrxrgE
Plus this Love2D reference (thanks to GloryFish):
https://github.com/GloryFish/love2d-verlet-cloth
There are tons of live Verlet physics demos online using HTML5:
- https://subprotocol.com/system/tree.html
- https://codepen.io/guerrillacontra/pen/XPZeww
- https://codepen.io/CLMcCorkle/pen/vrxrgE
Plus this Love2D reference (thanks to GloryFish):
https://github.com/GloryFish/love2d-verlet-cloth
Re: Fast Rope Physics for bump.lua?
Now I'm lost about what you want exactly, as this contradicts the ropes forming a catenary and all that.Gunroar:Cannon() wrote: ↑Mon Mar 15, 2021 7:57 pm Nice, I'll look into those thoouugh...I really want my rope to be simple, like straight lines
Bump only handles rectangles, specifically axis-aligned ones. I don't think a rope can be modelled as an axis-aligned rectangle.Gunroar:Cannon() wrote: ↑Mon Mar 15, 2021 7:57 pm that only bend when they go around a corner(so you could say the physics part is when it comes down to other objects pushing each other. That's why I wanted it done in bump .The "rope" should bends only when it goes around a corner.
Maybe a drawing will help understanding what you want. From your description, this is the picture that comes to my mind:Gunroar:Cannon() wrote: ↑Mon Mar 15, 2021 7:57 pm That's why I found it hard to use the normal algorithms I already found(plus its for top down use, so no gravity)...heheh.
So with this said any new ideas, or can it still be done with the other ropes?
where the boxes are always axis-aligned.
- Gunroar:Cannon()
- Party member
- Posts: 1143
- Joined: Thu Dec 10, 2020 1:57 am
Re: Fast Rope Physics for bump.lua?
Yeah! Exactly like that. I didn't want the rope to be in the bump world, just to manipulate the ones it's attached to, and to be drawn. So any idea how to do it?
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests