Throwing Objects/Set Position

Get help using Construct 2

Post » Fri Mar 15, 2013 3:59 am

Hi friends.
I'm making a game where I want to be able to drag and drop an object, but with having it so that if you let go of an object it motion, it will continue to be in motion (like throwing something with your mouse)

The problems I've encountered with drag and drop and set position is that they immediately halt movement after you let go. Alternatives with "apply force towards position" are way too random and you lose a lot of control over the object.

Can anyone help me out with a solution?
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Fri Mar 15, 2013 5:05 am

google the forums for "lerp", or use the easetween behavior.
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Fri Mar 15, 2013 7:34 am

Throwing objects with physics... solution



Hope this helps.linkchrisbrobs2013-03-16 13:08:19
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Fri Mar 15, 2013 5:36 pm

Thanks for the capx but that's not quite what I had in mind. Basically I want to be able to hold the object with the mouse before throwing it. I looked into easetween and i don't really know if it's what I'm looking for. I can't get it to work correctly. It seems to be for animation rather than physics.Sushin2013-03-15 18:17:04
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Fri Mar 15, 2013 8:43 pm

i'd find a a way to track the mouse positions at the beginning of the throw and on realease, and time the interval between the two. this should allow you to find the speed and angle of release, then feed that information into the physics object.
sorry i can't be any more help without trying to build it myself, but have a play around to see if this works.
B
14
S
3
G
4
Posts: 52
Reputation: 3,271

Post » Fri Mar 15, 2013 9:41 pm

[QUOTE=Sushin] Thanks for the capx but that's not quite what I had in mind. Basically I want to be able to hold the object with the mouse before throwing it. I looked into easetween and i don't really know if it's what I'm looking for. I can't get it to work correctly. It seems to be for animation rather than physics.[/QUOTE]

Solution (1 event)
On drop - Apply impulse 6 toward (MouseX, MouseY) at image point 0
(Crate uses drag and drop behaviour)

Edit...The event above doesnt not work !


This is my latest attempt-

Throwphysics2

chrisbrobs2013-03-16 13:07:07
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Sat Mar 16, 2013 6:25 pm

[QUOTE=chrisbrobs] [QUOTE=Sushin] Thanks for the capx but that's not quite what I had in mind. Basically I want to be able to hold the object with the mouse before throwing it. I looked into easetween and i don't really know if it's what I'm looking for. I can't get it to work correctly. It seems to be for animation rather than physics.[/QUOTE]

Solution (1 event)
On drop - Apply impulse 6 toward (MouseX, MouseY) at image point 0
(Crate uses drag and drop behaviour)

Edit...The event above doesnt not work !


This is my latest attempt-

https://dl.dropbox.com/u/22173473/ThrowPhysics2.capx

[/QUOTE]

Oh..That actually works great.
One problem though. I'm trying to get it to work with right clicking instead of left clicking which drag and drop stupidly doesn't seem to support. How can I do this without drag and drop?
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Sat Mar 16, 2013 8:27 pm

Sushin@

Oh..That actually works great.
One problem though. I'm trying to get it to work with right clicking instead of left clicking which drag and drop stupidly doesn't seem to support. How can I do this without drag and drop?

THROW3 EXAMPLE

(Drag and drop removed)
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Sat Mar 16, 2013 8:52 pm

Thanks a lot sir. =)
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Wed May 29, 2013 11:13 pm

@chrisbrobs could you repost the capx? I need the same thing. Thanks!
B
57
S
10
G
6
Posts: 455
Reputation: 8,530

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests