[Solved] How do I real box physics?

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • But that's wrong, either it tilts left or right... come on little pixel block, MAKE A DECISION! xD

  • 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.

  • when I set angle to 45.01 (or 45.1), it works

  • Ok, I use the following action after create the box:

    Set angle to 45 + choose(0.1, -0.1) degrees[/code:174d4lnn]
    It works! 
    
    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.
  • 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.

  • The action calls "Physics: Forced - Set velocity" and I use the following values:

    X component: (Object.X - Touch.X) * 8
    Y component: (Object.Y - Touch.Y) * 8[/code:3ju83d7l]
  • You could use 'Apply impulse at angle' additionally to your 'set velocity'-event. Maybe you have to try different values to get it work.

  • 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! 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)