Help with physics

For questions about using Classic.

Post » Tue Oct 18, 2011 1:56 pm

Heys guys!

Does anyone know how to drag and drop physic objects, while keeping the collisions?

Thanks in advance ;)
B
4
S
3
G
3
Posts: 125
Reputation: 1,450

Post » Tue Oct 18, 2011 2:18 pm

What method are you currently using?

I may be able to help if I have a little more information about what you have already tried, as not to recover the same ground.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Tue Oct 18, 2011 2:32 pm

[QUOTE=SoldjahBoy] What method are you currently using?

I may be able to help if I have a little more information about what you have already tried, as not to recover the same ground.

~Sol[/QUOTE]


Well, I tried to use "set force towards position", with the mouse coordinates, but the object keeps moving around the mouse. I suppose it needs some math calculations which I'm not good at :P

And if I use the drag'n drop behavior it doesn't collide with other Physic objects while dragging...
B
4
S
3
G
3
Posts: 125
Reputation: 1,450

Post » Tue Oct 18, 2011 3:16 pm

I would try something like:

+ Hold mouse button down
+ Mouse is over object
-->Set private variable "is dragging" to 1

+Private variable "is dragging" equals 1
--->Set object.X to Mouse.X
--->Set object.y to Mouse.Y

+Hold mouse button down (negated so it's a NOT)
--->object set private variable "is dragging" 0


That should work.

~SolSoldjahBoy2011-10-18 15:17:01
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Tue Oct 18, 2011 3:56 pm

[QUOTE=pyteo]if I use the drag'n drop behavior it doesn't collide with other Physic objects while dragging...[/QUOTE]

I've tried it and it works

You can still pull it through the immovable objects, though.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Tue Oct 18, 2011 7:04 pm

[QUOTE=SoldjahBoy] I would try something like:

+ Hold mouse button down
+ Mouse is over object
-->Set private variable "is dragging" to 1

+Private variable "is dragging" equals 1
--->Set object.X to Mouse.X
--->Set object.y to Mouse.Y

+Hold mouse button down (negated so it's a NOT)
--->object set private variable "is dragging" 0


That should work.

~Sol[/QUOTE]

Thanks but i've already tried that. The problem is, you can only use physics events to move the object, otherwise they will not collide and that's what I really need... :(
B
4
S
3
G
3
Posts: 125
Reputation: 1,450

Post » Tue Oct 18, 2011 8:39 pm

Anyone?
B
4
S
3
G
3
Posts: 125
Reputation: 1,450

Post » Wed Oct 19, 2011 12:20 am

You could try destroying the object on click, and then creating a dummy that doesn't use physics.
Then on mouse release, destroy dummy, create physics object.
Trigger once is your friend.newt2011-10-19 00:21:43
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests