Physics objects drag and drop with using pivots

Get help using Construct 2

Post » Wed Feb 08, 2012 12:16 pm

Hi All,

I am trying to have allow a sprite to be picked up by it corner and have the physics engine decide how the sprite rotates when picked up see image bellow for an example.




Thank you in advance for any help.
B
19
S
2
G
1
Posts: 9
Reputation: 1,792

Post » Wed Feb 08, 2012 1:03 pm

I think you would need to set a image point in each corner of the sprite, and pick out the closest image point when you click on the sprite.

With this image point, you can make a revolute joint between the sprite and the mouse pointer.
B
3
Posts: 6
Reputation: 312

Post » Wed Feb 08, 2012 1:14 pm

Thanks for your reply, I would like the image point to be selected dependent on where the cursor is when the Sprite is dragged.Do you know of any way this is possible?
B
19
S
2
G
1
Posts: 9
Reputation: 1,792

Post » Wed Feb 08, 2012 2:10 pm

Here it is:

Physics drag and drop example

Since there's no way to destroy a joint after it is created you need to destroy the object.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Wed Feb 08, 2012 4:55 pm

Thanks for the quick response, unfortunately when I try and run the file it says that it "cant open it chrome, please update your browser". every other sample game work and chrome is up to date? not sure what to do, I have turned off my firewall still have the same problem. Any ideas?

Could some one else try the file, so I can see if its my set up at fault.
B
19
S
2
G
1
Posts: 9
Reputation: 1,792

Post » Wed Feb 08, 2012 5:20 pm

Right, I got it working in Firefox now but still have a problem with Chrome, not sure whats going on, maybe its a bug. It works fine in chrome on my laptop. I might try a re install, I tell you how that pans out.

About the file it works great apart from you need to double click in the box to drag the sprite. is there a way to correct this? Any Ideas.

many thanks for your efforts so far? what a fantastic community.
B
19
S
2
G
1
Posts: 9
Reputation: 1,792

Post » Wed Feb 08, 2012 5:49 pm

Just an update I have re-installed construct2 and it all works fine, still trying to figure out how to pick up the box without double clicking, if any one can help it would be much appreciated. Many Thanks.
B
19
S
2
G
1
Posts: 9
Reputation: 1,792

Post » Wed Feb 08, 2012 6:12 pm

I don't know why it's not working sometimes, maybe it's a bug.
I modified the events a little an now it works:

Corrected example
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Wed Feb 08, 2012 7:23 pm

@Animmaniac thank you so much for time you have put in, It still seems to have the same behavior for me. The block can be moved whilst its moving but you still need to double click to pick it up first time. I am playing with it but cant find a work around (but I am a Novice at this). Great solution to the original problem by the way.

On a unrelated issue the files you are putting up wont open in chrome, I get an error, by chance are you running windows 7, 64 bit? As the files run fine on my 64bit laptop.

B
19
S
2
G
1
Posts: 9
Reputation: 1,792

Post » Wed Feb 08, 2012 7:43 pm

Strange behavior. When I changed it before, everything was working fine. Now that I re-opened the file it doesn't work every time. Almost seems like if I stay messing with it and previewing for a while it works. Then if I close and come back later it doesn't.

By the way it works fine in Chrome, and I'm running in win7 32bits desktop.

Edit: I just noticed that for some reason it doesn't work in Firefox, only in Chrome.
Edit2: Forget what I said, it works randomly and buggy. Let's hope someone can shine a light on it.Animmaniac2012-02-08 19:54:14
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Next

Return to How do I....?

Who is online

Users browsing this forum: KeetonCat, makkancs, Matthew de and 26 guests