Collision of sprites with physics

  • Hey guys,

    I am stuck on a very simple subject. I have a project similar to this:

    dropbox.com/s/28ebqmjx0sds9ck/collision.capx

    I want the wall to be solid. When the car hits the wall it should stop. If I attach the "solid" behavior to the wall, the car starts to slide strangely and unnaturally against the wall. If I attach "physics" to the wall and set "Immovable" to "yes", the car just passes through the wall. Why does not the car stop?

    In my project the car both has the "physics" behavior (to interact with other objects) and the "cars" behavior to move.

    Any help is appreciated <img src="smileys/smiley2.gif" border="0" align="middle" />

  • You should never use the 'physics' behavior together with other movement behaviors - it just doesn't work like that. You will have to design your own system of applying torques and forces to make the car move and get rid of the car behavior, or alternatively get rid of the physics behavior and use C2's collision system.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey sqiddster,

    Thanks a lot for the quick response :) If I delete the car behaviour (and make the car move by applying forces) then the "Immovable" set to "yes" on the wall will have effect?

  • Have you looked at the examples that come with C2?

    There is a physics car one called 'Physics - vehicle.capx' which may help. Setting immoveable to 'Yes' should have the required affect of stopping the physics car.

  • Thanks zenox98. The examples helped me. I got it working now :)

    A little offtopic but how could I make the steering a bit more direct? Now it seems like the car is floating/ flying.

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