Car back with impulse

Get help using Construct 2

Post » Mon Aug 20, 2012 7:04 pm

Hi everybody
My first post ...)


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


Thank
B
21
S
12
G
4
Posts: 31
Reputation: 4,537

Post » Tue Aug 21, 2012 5:59 am

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.



boredbash2012-08-21 06:34:30
B
6
Posts: 16
Reputation: 882

Post » Tue Aug 21, 2012 4:33 pm

Hi thank you but for me don't work
The result is very horrible please check
[code]http://speedy.sh/enAsT/colisiontestpush.capx[/code]
B
21
S
12
G
4
Posts: 31
Reputation: 4,537

Post » Wed Aug 22, 2012 2:38 pm

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








https://dl.dropbox.com/u/93923432/car%20back.capx
link to CAPX


boredbash2012-08-22 14:41:21
B
6
Posts: 16
Reputation: 882

Post » Thu Aug 23, 2012 4:04 pm

[<:o)]   Excellent thank you very mush I will study your logic
Thank you boredbash for your help and capx...
B
21
S
12
G
4
Posts: 31
Reputation: 4,537

Post » Thu Aug 23, 2012 10:15 pm

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
[code]http://speedy.sh/fSW8t/colision2.capx[/code]kantin2012-08-23 22:16:27
B
21
S
12
G
4
Posts: 31
Reputation: 4,537

Post » Wed Aug 29, 2012 12:53 am

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.boredbash2012-08-29 00:58:34
B
6
Posts: 16
Reputation: 882

Post » Fri Aug 31, 2012 8:17 pm

Work great thank you
B
21
S
12
G
4
Posts: 31
Reputation: 4,537


Return to How do I....?

Who is online

Users browsing this forum: mercuryus, Naightwolf and 18 guests