Physics and Mouse...

Get help using Construct 2

» Fri Sep 14, 2012 8:46 pm

Hi!

I tried to find a solution, but I can't...

For example we a have a physic ball on the stage. I need to make the following - grab a ball with mouse and throw it somewhere...
1) The ball should not floating around a cursor (like in using "force toward a point" in construct examples.
2) The speed of the ball after whe release a mouse button should depends on the speed of cursor while we make a "throw movement"

Hope, you understand right...

B
3
Posts: 9
Reputation: 418

» Fri Sep 14, 2012 9:04 pm

Working on an example for you now ;)
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,749

» Fri Sep 14, 2012 9:12 pm

Thank you!

I think if you succeed, it will be a very useful example to any new construct user...
B
3
Posts: 9
Reputation: 418

» Fri Sep 14, 2012 9:23 pm

Here you go!

I think this is what you wanted. Note that the ball loses all collision while being dragged. If this is unacceptable, the solution will be more complicated (you'd use a custom movement behavior) but for most applications I don't see it being too much of a problem. The ball also loses all angular velocity on drag, but again keeping this seems to me fairly useless.

Hope this helped!
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,749

» Fri Sep 14, 2012 9:45 pm

Thahx!

It's a good solution!

But are there a variants not to change the balls during draging? If we can drag a physic object in the same way, it solves the problem with lost collisions...

In a hole, I want to create a sandbox with a ragdoll... that's why I have such tasks.

If I apply your method and try to grab a head of my ragdoll - will the rest parts be in physic mode and react to "world gravity", collisions etc? I think there will be a problems and multiple bugs..

What do you think, sqiddster?
B
3
Posts: 9
Reputation: 418

» Fri Sep 14, 2012 9:59 pm

Hmm, that is a problem. I'm not quite sure if there's any other reliable way to do it.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,749