Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 2D Physics Rubber band

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Feb 2020 06:13 Edited at: 5th Feb 2020 06:16
How would i create a rubber band effect in 2D physics?
So i have 2 points and an elastic string between those points
If i drop a ball onto the string, it deforms, absorbs the momentum and flicks the ball back

A bit like this;
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 5th Feb 2020 06:50 Edited at: 5th Feb 2020 06:50
Personally, I wouldn't consider the rubber band to be a physics object. I would draw it manually then when you release it, you calculate the direction and magnitude of the force to exert and apply that to the physics object you are launching.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Feb 2020 06:55
Neat Program
I think it has to work like a chain the below link might help
https://forum.thegamecreators.com/thread/222435
MerryChristmas Everyone
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Feb 2020 07:24 Edited at: 5th Feb 2020 07:24
Ok. Thanks. Some things to consider
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Feb 2020 15:17
Scraggle has a good idea there
The below will give you the up and down concept add some physics and ofcourse modify to get the sideway effect
and it may be what you need. My math failing me atm I cant remember what to add to give the side way effect to the
curve
MerryChristmas Everyone
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 5th Feb 2020 16:41 Edited at: 5th Feb 2020 17:00
Here you go.
It's very rough and ready and you could do a lot to improve it but it is a workable "proof of concept"

No media required. Just click on the red 'ball' and drag it. Then release to launch it.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Feb 2020 21:36
Thanks guys! I will check it out
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 5th Feb 2020 21:43
Brilliant Scraggle here I was trying to overcomplicate

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk

Login to post a reply

Server time is: 2024-11-22 11:16:25
Your offset time is: 2024-11-22 11:16:25