Stopping car from bouncing during collision

Get help using Construct 2

Post » Sun Aug 12, 2012 12:29 pm

Hello guys,

I have game where car is driving on the road. Then another sprite is wall and when I hit the wall with car I want the car not beeing able to drive through the wall. I though I got it right but my method sometimes does not work and someties car somehow go through wall.

Car has variable "way". When way is 0 car is going backwards when way is 1 car is going forward. I did that so I know if car goes backwards or forwards. In conditions I have this:




Most of the time it works. However sometimes car gen go through the wall and I dont know. Do you know what could be the problem?

The wall is not sprite but tiledbackground.

Thank youMichal112012-08-12 12:34:04
B
8
S
2
Posts: 45
Reputation: 1,168

Post » Sun Aug 12, 2012 2:08 pm

You don't need to create event's for the wall. u only need to give it behavior "solid" and that should work.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
71
S
19
G
19
Posts: 1,919
Reputation: 16,910

Post » Sun Aug 12, 2012 2:15 pm

Well that is exactly what I dont want. Because if you create wall as solid and then car has collision with it it bounce like crazy :)Michal112012-08-12 15:42:00
B
8
S
2
Posts: 45
Reputation: 1,168

Post » Sun Aug 12, 2012 3:37 pm

Add an event that says when the car collides with a wall set the cars speed to zero.
B
6
Posts: 16
Reputation: 882

Post » Sun Aug 12, 2012 3:47 pm

[QUOTE=boredbash] Add an event that says when the car collides with a wall set the cars speed to zero.[/QUOTE]

Unfortunately this does not help as well :/ It must be something else. As I said most of the time 90% it works. But sometimes when my speed is too high or if I hit the wall and then try to turn my car to the side and collide with wall by car's side it goes through
B
8
S
2
Posts: 45
Reputation: 1,168

Post » Sun Aug 12, 2012 3:52 pm

I uploaded capx to dropbox if anyone would be interested in helping me out :)

https://dl.dropbox.com/u/97534866/testing.capx
B
8
S
2
Posts: 45
Reputation: 1,168

Post » Mon Aug 13, 2012 10:44 am

Give the fence a solid behavior then on collision with fence set car speed to lerp(player.Car.Speed,50,0.8). You can play around with the numbers, I'm not sure what I'm doing but it seemed to work for me
B
8
S
1
G
1
Posts: 35
Reputation: 1,170

Post » Mon Aug 13, 2012 11:10 am

[QUOTE=Plowman] Give the fence a solid behavior then on collision with fence set car speed to lerp(player.Car.Speed,50,0.8). You can play around with the numbers, I'm not sure what I'm doing but it seemed to work for me [/QUOTE]

Thank you but it did not help either :).

I somehow cannot believe nobody here knows how to do standard car collision with wall :)
B
8
S
2
Posts: 45
Reputation: 1,168

Post » Mon Aug 13, 2012 11:22 am

Don't use a tiled background, use several instances of the same sprite with an adapted collision polygon.

Also you might want to use the condition "is overlapping at offset" to anticipate the collision, and not just react to it as with a "on collision" trigger.Kyatric2012-08-13 11:23:03
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Mon Aug 13, 2012 11:25 am

I don't see any "crazy bouncing" using the solid behaviour:

Michal11.cpax
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Next

Return to How do I....?

Who is online

Users browsing this forum: Artpunk, Braus, Kagubro, Mirlas, zeneizel and 22 guests