[Solved] How do I real box physics?

Get help using Construct 2

Post » Thu Oct 29, 2015 12:39 pm

Hello everybody,
I want to create "real" box physics. Here is my *.capx: https://www.dropbox.com/s/uzfn4voyl8gxqdv/box.capx?dl=0
The box has a angle of 45 degrees. But if they fall off, they will not to tumble. What's going wrong?
Last edited by wossi on Thu Oct 29, 2015 2:54 pm, edited 1 time in total.
B
7
S
2
Posts: 84
Reputation: 754

Post » Thu Oct 29, 2015 1:06 pm

That looks funny. Maybe some kind of bug or glitch. However, if you set the angle of your PlayersObject to other than 45 ist works.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Thu Oct 29, 2015 1:30 pm

But that's wrong, either it tilts left or right... come on little pixel block, MAKE A DECISION! xD
B
7
S
2
Posts: 84
Reputation: 754

Post » Thu Oct 29, 2015 1:48 pm

If you really need that the box randomly tipping left or right you could add randomly 0.1 or -0.1 to the angle when the box is created.

PlayersObject| OnCreated -> PlayersObject| Set angle to PlayersObject.Angle+choose(-0.1,0.1) degree.

Now it should randomly fall to left or right.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Thu Oct 29, 2015 1:55 pm

when I set angle to 45.01 (or 45.1), it works
Image Image
B
22
S
13
G
130
Posts: 869
Reputation: 67,816

Post » Thu Oct 29, 2015 2:14 pm

Ok, I use the following action after create the box:
Code: Select all
Set angle to 45 + choose(0.1, -0.1) degrees

It works! :D

But, I have another problem with "shooting the box". If I kick the box, they should be rotate automatically. Currently it does not look real. :?
B
7
S
2
Posts: 84
Reputation: 754

Post » Thu Oct 29, 2015 2:27 pm

I don't know which event do you use to 'kick' your box, but most events have the possibility to set an Image-Point where the force will hit. Make a second Image Point slightly of the center and use this Image-Point. Now your box should rotate.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Thu Oct 29, 2015 2:31 pm

The action calls "Physics: Forced - Set velocity" and I use the following values:
Code: Select all
X component: (Object.X - Touch.X) * 8
Y component: (Object.Y - Touch.Y) * 8
B
7
S
2
Posts: 84
Reputation: 754

Post » Thu Oct 29, 2015 2:48 pm

You could use 'Apply impulse at angle' additionally to your 'set velocity'-event. Maybe you have to try different values to get it work.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165

Post » Thu Oct 29, 2015 2:54 pm

I set the image point to top left and after the "set velocity" action, I add a "set angular velocity" action. I'll test it with "-100" and now... it works! :D Thank you very much!

~edit: Ok, you don't need to set the image point to top left. It works also, if the image point is set to middle.

~solved
B
7
S
2
Posts: 84
Reputation: 754


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests