Using Box2d for a top down perspective

Get help using Construct 2

Post » Tue Mar 13, 2012 4:24 am

Looking for any help using Box2d for a top down perspective game, when car collides with a traffic cone (for example), the traffic cone will slide along the floor.
as far as I can tell there are no options to change to top down perspective in Box2d so if any one has suggestions not using this that would be great.   
B
11
S
1
Posts: 57
Reputation: 1,519

Post » Tue Mar 13, 2012 6:02 am

You should be able to get this effect by disabling gravity -- that is, setting it to 0.

If you set up an event to trigger "on start of layout", and then add an action to ANY item with the physics behaviour to "set world gravity" to 0 (under the "physics: global settings" header) you should be good to go.

Does that help?
B
24
S
5
G
2
Posts: 104
Reputation: 3,136

Post » Tue Mar 13, 2012 9:24 am

I will try now and let you know, thank you very much
B
11
S
1
Posts: 57
Reputation: 1,519

Post » Tue Mar 13, 2012 10:19 am

http://dl.dropbox.com/u/55190477/car.capx

hmm its not going well, the gravity is perfect but when car collides with the ball it doesn't move. Im really stuck as I am having difficulty with all these expressions. I am trying to get the ball to go in the oppersite direction to the car.
B
11
S
1
Posts: 57
Reputation: 1,519

Post » Tue Mar 13, 2012 10:28 am

On collision between car and cone
.. Cone: Physics: Apply impulse at angle

Force of impulse: start with 10 and tweak your way according to your likings
Angle : angle(car.x, car.y, cone.x, cone.y)
If this gives the opposite direction, simply switch the parameters (cone first, car after).

And for the use of physics, be sure to read tutorials about physics.
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,998
Reputation: 57,791

Post » Tue Mar 13, 2012 10:51 am

Thanks for your help I shall give it a go now
B
11
S
1
Posts: 57
Reputation: 1,519

Post » Tue Mar 13, 2012 8:36 pm

You shouldn't need to apply an impulse manually (although you certainly can!) if the car and cone are both physics objects.

Make sure both items have the physics behaviour applied, that neither object has "immovable" set to yes, and that both objects have an appropriate density (the car's should be quite a bit larger than the cone) specified.
B
24
S
5
G
2
Posts: 104
Reputation: 3,136

Post » Wed Mar 14, 2012 5:16 am

jbadams you are a legend, thank you so much that worked perfectly
B
11
S
1
Posts: 57
Reputation: 1,519

Post » Wed Mar 14, 2012 5:17 am

kyatric thank you also, didn't quite do the desired effect but it is defiantly useful to know what you taught me.
cheers guys
B
11
S
1
Posts: 57
Reputation: 1,519


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Solomon and 28 guests