[Solved]Pinning with Physics

Get help using Construct 2

Post » Thu Dec 29, 2011 8:09 am

Here's a doooosey,

Is it possible to have two sprites with physics behaviors and bounding box collision pinned to each other. I did a simple test with two squares, added pin behavior and physics behaviors. Then did
System-On start of layout->Sprite1 Pin pin to Sprite2.
When I launch the preview, they both for a split second are together then bounce apart next to each other then fall at the same rate to the floor.

My mind is guessing to some how put in a condition where either the physics or the collision is disabled and then triggered on when needed but I could use a point in the correct direction on on just getting them to stick together lol.

I tried to check the Pin section of the manual but it was a little bare :)
studiogami2011-12-29 08:29:42
B
16
S
2
G
5
Posts: 30
Reputation: 3,925

Post » Thu Dec 29, 2011 8:17 am

I suggest you to read again the Basic physic tutorial especially the note about manual movement & other behaviors.

Pinning two physic objects to each other (knowing that they'll automaticly push out from each other) is to be considered as irrealistic behavior.
You should rather consider making a distance or revolute joint (Advanced physic tutorial).

With such sensible/experimental (the plugin is still to be considered beta) topic as physics I recommand to read both tutorials and the future manual entry (not written at the date of this post, but it should be a matter of days/weeks at this point) often to refresh one memory.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Thu Dec 29, 2011 8:19 am

I think I have a work around, and a logical one at that. If I have both object's pinned, both having physics is pointless. So I removed physics from sprite2 and on sprite2 I just used Set position to sprite1.x and sprite1.y. Now I just have to find a way to trigger physics onto sprite2y when needed.

I created a group called together and set it active on start.
Pinned one sprite to the other and when they collide with trigger, group is disabled and reaction occurs.

studiogami2011-12-29 08:30:45
B
16
S
2
G
5
Posts: 30
Reputation: 3,925

Post » Thu Dec 29, 2011 8:22 am

What are you exactly trying to archive? I've been useing a similar technique within my Pinball Demo
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Thu Dec 29, 2011 8:31 am

Pilot in a plane, when plane falls below certain height on the screen, pilot bails out.
B
16
S
2
G
5
Posts: 30
Reputation: 3,925

Post » Thu Dec 29, 2011 12:38 pm

Just destroy the 'pilotInPlane' Sprite and spawn a new 'PilotOut' sprite with physics.
Game programming often requires some tricks (:
In the end that's what the player sees that matters.Yann2011-12-29 12:38:47
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Dec 29, 2011 4:01 pm

Mmmm that's a good idea!
B
16
S
2
G
5
Posts: 30
Reputation: 3,925


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests