[Physics] More realistic Drag&Drop movement?

Get help using Construct 2

Post » Wed Apr 16, 2014 9:04 am

Hi,

I'm trying to make a physics game. Part of it involves draggind and dropping different shapes. My problem right now is to make objects act more realistically when I click and drag them. I need them to understand where I clicked and act accordingly. Let's say I have a width 10 x height 2 plank and i click on the left side of the plank and start dragging. The right side of the plank should ofcourse fall because the laws of the physics. I can't achieve that on my own so I need your help on where to look...

Also, if there's no way to do that, is it possible to get more realistic results with multiple image points or something?

Thank you!
B
4
Posts: 10
Reputation: 225

Post » Wed Apr 16, 2014 2:24 pm

super duper simple easy peasy.

Create a physics Object on touch. hinge joint the plank tot he physics object. drag on the physics object around. Make sure to use strong forces on the physics object and NOT set position. the hinge joint on the plank will create the effect your looking for.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Wed Apr 16, 2014 2:45 pm

Just wondering, @jayderyu, if you know of an equation that could give a smooth non-revolvey movement?
I've been using this formula...
((distance(Objects.X,Objects.Y,Cursor.X,Cursor.Y)^2 / 500 + 10) + Objects.Physics2.LinearDamping * sqrt(sqrt(sqrt(distance(Objects.X,Objects.Y,Cursor.X,Cursor.Y))))) * Objects.Physics2.Mass / 100 + sqrt(distance(Objects.X,Objects.Y,Cursor.X,Cursor.Y))
But I think that's probably a bit overkill, and it can most likely be factorised / simplified as well.

Edit: You'd be surprised how well it works though =P
B
42
S
14
G
3
Posts: 165
Reputation: 5,115

Post » Wed Apr 16, 2014 3:01 pm

Thank you for your input!

OK.... I have no idea (I played with joints but no luck for me) how to implement those in to my project. I'm newish with C2. I'm not looking for someone to do it for me but... If it's not too much to ask, a small example would help.

For clarification, my layout consists of 5-15 planks (french fries) and a ball (meatball, ofcourse). Player has to make a somekind of tower from the draggable french fries and then get that platformer meatball to climb to freedom. Best idea for a game, I know.
B
4
Posts: 10
Reputation: 225

Post » Wed Apr 16, 2014 3:02 pm

...and everything else kind of works but I just want those fries to act normally :)
B
4
Posts: 10
Reputation: 225


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, cb130felix, Kermad, Lancifer, nyuszi008 and 7 guests