[Behavior] Car physics

0 favourites
From the Asset Store
Everything is made via physics, Very simple code: 6 events only (3 for tank creation, 2 for controls and 1 for camera)
  • <center>Car physics behavior</center>

    Current version is (BETA) 0.1!

    This behavior enables a top down-view car (body + 4 wheels) and a side-view car (body, 2 wheels and 2 axles) to act as a car, fully integrated with the Construct physics world.

    This is a very early version, and it does miss certain functionalities and performances that I am hoping to add/fix in the near future. But I thought I would release it as it is now, to let people try it on and play around!

    V.0.1

    • Created a tutorial page for this behavior plugin:

    http://www.scirra.com/tutorials/323/create-car-physics

    • Code structured and optimized for better performance.
    • Added extra actions to enable more dynamic settings specific for the sideview car physics in real time.
    • Added extra properties variables to enable more dynamic settings specific for the sideview car physics.
    • Added Sideview Car physics. A sideview physics car is based on a body, two wheels and two axels combined together.

    The sideview car physics reacts just as the topdown car physics with wheel friction, linear dampning etc etc.

    [ISSUES]

    You cant change the friction of any of the wheels or car body in real time. If you change the friction the car will fall apart and will not be usable. This is because when changing the friction, Construct 2 destroys and rebuilds the physics body for that specific sprite.

    The physics do make a rebuild call, but its resetted internally inside the physics.

    As it is now, there is no way for me to catch that rebuild call, without altering the source code of the physics, which is not allowed or recommended!

    I have added a request to change that in the SDK forum, and hopefully the nice people at Scirra can add a flag, allowing me to catch a rebuild call.

    <center>Download Car Physics behavior v.0.1

    Very simple top-down car physics example for v.0.1

    Very simple side-view car physics example for v.0.1

    </center>

    For more information and a tutorial how to create car physics, please

    visit the tutorial:

    http://www.scirra.com/tutorials/323/create-car-physics

  • <img src="http://i.imgur.com/bSz7F.png" border="0" />

    When clicked Ok and i ran to see preview, this car works while i press up and down arrows, but not left and right arrows

  • Joannesalfa

    I have updated the tutorial, so the warning doesn't appear anymore.

    When you say it didn't work when you press the left and right arrows, was the car in motion when you tried? Did the forward wheels rotate to the sides when you pressed?

    Because the car needs to be in motion to turn and the wheels rotate based on the turn speed given.

  • I have released a update on the Car Physics behavior!

    There is a lot of new functions and properties and much more is coming.

    The new version is (BETA) 0.06!

    See the orginal post for more information, or click here!

  • I have released a update on the Car Physics behavior!

    There is a lot of new functions and properties and much more is coming.

    The new version is (BETA) 0.1!

    The latest and greatest in this update:

    Side-view car physics

    This action lets you to create a side-view physics car.

    This car is based on a body, 2 wheels and two axles.

    New properties settings have been added to the behavior and some new

    actions.

    Car Physics tutorial

    I have created a tutorial for this behavior, which explains a little on

    how it works and what you need to do to make a physics car.

    http://www.scirra.com/tutorials/323/create-car-physics

    For more information, see the orginal post or

    click here!

  • Hi! I hope I haven't missed anything that explains it, but is it possible to make a RWD car?? So that the front wheels would turn but the rear wheels would push the car forward.. The car could then powerslide with the throttle!!(I wish) <img src="smileys/smiley20.gif" border="0" align="middle" />

  • chef

    I have/had plans to make both RWD and AWD systems for the Car physics behavior. But work and family is taking up all my time, so currently I don't have the time to work on this project or on any of my other projects.

    I will update this behavior when I get around to it, but it will not be this year. Hopefully next year.

  • OK, I understand and appreciate your effort! Keep us informed. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • any one know about in-app billing in construct 2 how to add in-app billing in my android game with cocoonjs

  • I used your side-view car plugin and got my game running pretty well and planned to publish on windows store, but the visual studio validator gave me an error about untreated exception and crushed because of a variable "Tt".

    new Ac(d.Tt(d.PI/3),d.xu(d.PI/3)))

    Is this a serial problem and do I have any hope of getting my game to work or do I have to start building the whole movement thing up from scratch?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • trollface

    Are you certain that the error comes from this behavior and not from something else? The behavior is still in beta, so it is not finished.

    All behaviours/plugins are open source, so if you feel like it, you can always try to change around in the source code to fix the issue, if the issue do come from this behavior.

  • I already built my way around today using physics, the error came definitely from the plugin, I got my game up and running and it is currently waiting for approval. You should try to test debugging on visual studio to see if you get the same error. I hope that you find the bug and fix it.

  • CodeMasterMike Thank You for your great plugin. I would like to ask if there is a tested routine to mirror (set it to the orher direction) a side view car?!

    I've try to make a container, mirror pieces one by one, and setup the sideview again, but with no success, the pieces of the car falling off.

    Do anyone done it? Please help me if you can.

  • Epox

    I don't know any easy way to do that, sorry.

    In theory, you would have to destroy the behavior, mirror the car, and add the behavior to the car physics in order to make it go the other direction. How and if this is possible, I don't know since I haven't tested it.

    Maybe another way is to have one car pre-created in each direction and switch between them somehow, depending on which direction you want to go.

  • Hey CodeMasterMike,

    This behaviour is pretty cool. It took some tweaking but I have a car that's acting pretty nicely.

    A couple of things though;

    1 - I'd like to be able to compare the "speed" of the car, in order to apply some other forces for turning (like extra friction for slowing down, etc) but there appears to be no comparison for "speed".

    2 - The car always feels a bit "floaty" like it's driving on dirt. I've tried messing about with mass, friction, etc. but to no satisfying result. Any tips to get the car to feel more like it's driving on asphalt?

    Never-the-less... pretty nice all round :D

    *EDIT*

    Nevermind, I found the speed comparison. I must be blind! Still wondering about point 2 though ;)

    *EDIT AGAIN*

    One last thing I noticed, is you have to create the vehicle in a up/down direction, with the car facing up. Construct default direction is left/right, with the 'front' of the object facing right. This can make things confusing when trying to compare object directions. Any chance you can change it to suit the default Construct "rules"?

    *ONE MORE THING*

    When I export my project, be it HTML5, EXE, whatever... I get a plain black screen when I run it. If I remove the custom car physics behaviour, it works fine (but the car doesn't work any more, obviously). Must be a bug somewhere :/ Using Construct 2, R131, but about to update to 132 or 133 (whatever the latest is, as of today). *JUST TESTED R133* and it's still bugging out on export. I hope it's something simple to fix... I'm really enjoying this behaviour.

    ~Sol

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