How do I use friction to attach objects with physics

Get help using Construct 2

Post » Wed Mar 26, 2014 6:37 am

Hi,

I want to use physics to have an object falling into another one and when I move the one at the bottom (receiver), then it will move the ones on top. I try playing with the friction, assuming that if the friction at the bottom object is higher, the objects on top would stick to it (unless I move it very fast), but it didn't work.

Can anyone point me in the right direction? Is not physics what I need? (I was thinking about PIN behavior, but I do want the object to fall if you move too fast).

Here's the capx: https://dl.dropboxusercontent.com/u/19421237/TestFriction.capx

Thanks!!!!!
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Wed Mar 26, 2014 8:07 am

Creating joints in physics behaviour is about the same as the pin behaviour..
Using compare velocity, you could break the joint if the velocity is too high.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Mar 26, 2014 12:40 pm

@littlestain thank you!!!! Will look into it!!
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Thu Mar 27, 2014 2:14 am

@littlestain I tried using the limited joint, but there is a weird behavior happening. After a little bit, the shape gets stuck in the air. Besides, I have not been able to figure out the speed enough to break the joint (I thought that limited by the angle should allow me to break it without having to code the speed). Any suggestion or tutorial that you would recommend? I read all the documentation from Ashley in regards to physics, torque and everything else.

Thanks

New capx https://dl.dropboxusercontent.com/u/19421237/TestFriction2.capx
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Thu Mar 27, 2014 8:57 am

I can not open your second capx (using a plugin I don't use/have) but I had a quick look at your first one and noticed that you are using other behaviours (8direction) with physics (probably not a good idea as it can (will ?) cause problems - try to only control physics sprites with physics (eg impulse/force) )

Here is a quick edit of your first capx - although I do think that using a a joint will give you more control id does show that the basic idea of friction will work
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Thu Mar 27, 2014 1:21 pm

RamPackWobble wrote:I can not open your second capx (using a plugin I don't use/have) but I had a quick look at your first one and noticed that you are using other behaviours (8direction) with physics (probably not a good idea as it can (will ?) cause problems - try to only control physics sprites with physics (eg impulse/force) )

Here is a quick edit of your first capx - although I do think that using a a joint will give you more control id does show that the basic idea of friction will work



Hey Rampack!
Still making great examples I see..
I agree that the joint will give more control and probably make gameplay a bit more predictable for the player, but tyour example is pretty nice!
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Mar 27, 2014 1:54 pm

LittleStain wrote:Hey Rampack!
Still making great examples I see..
I agree that the joint will give more control and probably make gameplay a bit more predictable for the player, but tyour example is pretty nice!


Hi LS - nice to have you back. I am still getting distracted with these but I am still learning / reinforcing ideas by making them.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Sat Mar 29, 2014 5:33 pm

@RamPackWobble that is amazing! only 2 lines of events???? Wow! Amazing!!! Thanks so much!!!! I will keep looking into it...
@LittleStain thanks so much also for all the support!!! and tips... :)
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Sun Mar 30, 2014 5:58 am

Hi @RamPackWobble , @LittleStain sorry to bother again!!!!!

I thought it was going to be relatively easy, but I think I'm missing something.

I'm trying to figure out the amount of boxes on top of the red one at any given moment. For this I tried to consider that Physics Velocity on Y should be 0 and it should be located at an Y <= 362 (red box estimated height). To avoid counting the boxes that are not on top of the red, I destroy them when they touch the immovable object.

The count display is 1 at all times, I would expect to get a 2 and 3 and so on if I get more boxes on top. I would expect to get a 2 if I had 3 and lost one. etc...

- Should I use UID per each Sprite?
- Any idea of how can I determine that they are all above the red one?

I kept reading the manual and looking into this the whole day, so after trying multiples approaches (none successfully), I decided to ask again :)

Thanks again for any idea/suggestion or help.
You do not have the required permissions to view the files attached to this post.
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Post » Thu Apr 03, 2014 5:04 am

Anyone has an idea on how to make this happen? At least a suggestion so I can look into that? :) I tried UID but I was not able to make it work. I just need a little bit of direction... ;)

Thanks
B
8
S
3
G
1
Posts: 135
Reputation: 2,209

Next

Return to How do I....?

Who is online

Users browsing this forum: Armench, Artcadev, farsen, Yahoo [Bot] and 14 guests