0 Favourites

# Car back with impulse

• 8 posts
• Hi everybody

My first post ...)

http://www.imagup.com/data/1160151528.html

I would like that when the car is in collision with blue borders and that the vehicle is perpendicular, the car back with impulse

<img src="smileys/smiley4.gif" border="0" align="middle">

Thank

• You will want to add invisible blocks that are hit in place of the wall because of its shape.

Set these up along the wall as if they were the wall and set them to invisible.

Apply physics behaviour to all objects on the screen except the blue wall.

Set the physics properties of the invisible walls to immaovable and prevent rotations.

You will need the following conditions

Condition: On car collision with invisible wall

Car angle =0

OR

Car angle =90

OR

Car angle =180

OR

Car angle =360

Event: Car impulse at car.angle

So if when the car collides with the wall and it is one of the 4 angles perpendicular to the blue wall it will casue an impulse.

Im at work so can't test it let me know of that works.

• Hi thank you <img src="smileys/smiley42.gif" border="0" align="middle" /> but for me don't work

The result is very horrible please check

http://speedy.sh/enAsT/colisiontestpush.capx

<img src="smileys/smiley19.gif" border="0" align="middle" />

• Hey man sorry for the bad example. I never used car behavior before.

Basically anytime the car hits the wall and it is not perpendicular or at 0, 90,180 or 360 degrees set cars speed to zero to prevent it bouncing off.

Screenshot

<img src="https://dl.dropbox.com/u/93923432/car%20back.png" border="0" />

• [<:o)]   Excellent thank you very mush I will study your logic

Thank you boredbash for your help and capx... <img src="smileys/smiley4.gif" border="0" align="middle" />

• <img src="smileys/smiley1.gif" border="0" align="middle" /> Hi I have a little problem with impulse not work corectly

I want that the front car when the angle is equal at 90 or 180...360

I'd like

When the front of the car is in collision with the wall (angle 90,180,270,360)

when the keyboard space bar is released

then the vehicle as a bounce back with an impulse

http://speedy.sh/fSW8t/colision2.capx

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

Construct 3 users don't see these ads
• Hey man, sorry for late reply.

I suggest pinning an object to the front of the car (with the same poisition and angle as car)so we can detect when the front of the car hits the wall.

Then create an event that states when that object collides with the wall and it is between these angles - angle 360 and 1(which is 0),89 and 91 (which is 90), 179 and 181 (which is 180), 269 and 271 (270), 359 and 0 (which is 360) AND the space bar is being pressed then apply an impulse to the car at the same angle as the car. Try that.

BTW - I have trouble opening your CAPX files so I am not sure if this is what you wanted.

• <img src="smileys/smiley20.gif" border="0" align="middle" /> Work great thank you

• 8 posts