Pushing object with physics

Get help using Construct 2

Post » Sat Nov 26, 2016 10:21 pm

I have searched through the forums with no solutions that has helped me. I worked on a game with my friend once until he gave up but at that time he figured out making physics work by basically having the player push the box to the wall so he can jump to the ledge.

Whenever I toy with the physics, random things happen. I have read everywhere that the physics behaviour does not go well with other behaviours, but I really don't have a choice in that matter. The object will fall through the ground even with Solid and Physics behaviour so I had to add platform behaviour. And you were completely right about that physics don't go well with others. Basically everything started shaking and unexplainable sh*t started happening.

Can anyone simplify what I am trying to do? (Having player push box to the wall by just walking on it and then jump on top of the box and then to the edge of whatever the player want to go to).
I am just really having a bad time trying to figure out this, and I will greatly appreciate your help.
B
7
Posts: 26
Reputation: 332

Post » Sat Nov 26, 2016 11:14 pm

A solid object means it is solid only for other behaviors, no the physics one. If you want a solid physics object you have to add the physics behavior to your object, then change the Immovable property to "Yes".
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Sun Nov 27, 2016 10:16 am

andreyin wrote:A solid object means it is solid only for other behaviors, no the physics one. If you want a solid physics object you have to add the physics behavior to your object, then change the Immovable property to "Yes".

Doing this will only result me going through the object. I want to push it like a solid object to the wall. I swear there was a really simple way of doing this by just messing with the physics and other behaviours but I completely forgot how. Even if it was immovable and a solid object, I still can't push it which is the main point. I don't really want drag mechanic just a simple push when I walk onto it.
B
7
Posts: 26
Reputation: 332

Post » Sun Nov 27, 2016 3:46 pm

I managed to find out what I did wrong but now I have a different problem.

When I try push it, it barely moves (I have tried playing around with density and I know how that works), but when I walk backwards (by glitching the entire animation so it looks like i am walking right but instead i am walking backwards) it pushes it with no effort. I want this to be complete opposite.

This is how it looks https://gfycat.com/GrotesqueKindIcelandgull
B
7
Posts: 26
Reputation: 332

Post » Sun Nov 27, 2016 6:57 pm

If you can provide a capx, it will be easier to help you.

Do you use the sprite direction of the Player to set the force applied direction?
If you reverse the force applied direction does it work better?
B
12
S
7
G
4
Posts: 114
Reputation: 3,067

Post » Sun Nov 27, 2016 7:59 pm

Pandadoor wrote:If you can provide a capx, it will be easier to help you.

Do you use the sprite direction of the Player to set the force applied direction?
If you reverse the force applied direction does it work better?

I do not use any force direction. I use density for the player so he can push physics based objects.

Here is the capx: https://www.mediafire.com/?84ob92jgwrfogy4

I know you don't like any links other from dropbox, but I forgot how you uploaded a public file onto there so here is a mediafire one instead.
B
7
Posts: 26
Reputation: 332

Post » Sun Nov 27, 2016 11:02 pm

Mediafire isn't a problem for me but I had to install the last beta version of construct 2 plus 3 plugins that I had to find and install to open your project. ;)

To solve your problem, change the X origin of your Player for the moving animation to 50 instead of 55. (for the 4 frames)
(Put the X behind the X center of your Player: if you put X=1 as your Player origin when the original sprite face right, your Player will be superman)

One thing, you should set the same canvas size for all the Player moving frames, it will be easier for the origin. And you should improve the collision mask for the Player moving frames, this has an effect on the pushing.

If you want to keep an origin at the center of your Player for any reasons, you will have to use another point to apply the force.

From here
Point of application
You can also supply an image point when applying a force. This allows you to apply the force from a different position on the object. By default, it's applied from the object's origin, normally in the middle of the object.


If you don't understand let me know.
B
12
S
7
G
4
Posts: 114
Reputation: 3,067

Post » Mon Nov 28, 2016 9:02 pm

Pandadoor wrote:Mediafire isn't a problem for me but I had to install the last beta version of construct 2 plus 3 plugins that I had to find and install to open your project. ;)

To solve your problem, change the X origin of your Player for the moving animation to 50 instead of 55. (for the 4 frames)
(Put the X behind the X center of your Player: if you put X=1 as your Player origin when the original sprite face right, your Player will be superman)

One thing, you should set the same canvas size for all the Player moving frames, it will be easier for the origin. And you should improve the collision mask for the Player moving frames, this has an effect on the pushing.

If you want to keep an origin at the center of your Player for any reasons, you will have to use another point to apply the force.

From here
Point of application
You can also supply an image point when applying a force. This allows you to apply the force from a different position on the object. By default, it's applied from the object's origin, normally in the middle of the object.


If you don't understand let me know.


Well described and well informed. I understood everything you said. Thank you so much for teaching me on this issue! :)
B
7
Posts: 26
Reputation: 332


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests