This Project started in 2014 from a challenge to myself in doing real-time movable tank tracks in Blender Game Engine.
After accomplishing that goal, my understanding of Blender Game Engine grew along with my curiosity to learn how far I could go with Blender and the Game Engine alone in making a full game, while also learning to code.
New goals were set: learn the Game Engine further, find the limitations and try to overcome them, improve my skill in Blender as a modeler and use Blender as the sole software for all assets, scripts, textures, lights etc.
This is the result so far.
Features:- good vehicle physics
easy to adapt a new vehicle model to the physics system
ballistic gun shots with auto gun adjustment to the target
menu system where you can easily integrate a new vehicle or map
fun to drive and adjust parameters like:
auto shift gear up and down rpm
vehicle weight (mass)
drag and down-force
suspensions and much more
although you can individually adjust most of the parameters yourself, the system can also automatically adjust engine and suspensions giving just 3 or 4 parameters like horsepower, mass and drag coefficient
Some ideas still need to be polished but my goal is to develop something between a multiplayer tank game to a tank race game or both.- more vehicles and maps
- better overall special effects and graphics
optimizations (although this runs on a 2010 laptop with a modest Nvidia GT 425m at 60 to 90 fps, a lot can be done to improve
implement an online multiplayer system (big task - need support)
create an add-on for Blender to help customize a vehicle
release a public demo
ultimately try to improve Blender game engine itself (huge task - need a lot of support)
I am very fond of the environments shown. Would be very interested in seeing some images. This will also be a very fun tool for experimenting with vehicle physics and hopefully getting some wild results
The 1st model was actually a slate box with some spheres as wheels but these are just some of the tanks I worked on since I put some tracks finally working and the last one was the race tank Left Bottom corner.
The physics on these tanks use a mass of 5 tons and an engine ranging from 150 to 400 horsepower, top rpm from 2000 to 6000 and and gearbox of 5 or 8 gears giving a top speed of around 74 to 164 Km/h
Based on the last model of the Light tank, I’m now working on some bigger tanks so these models are WIP but they already have physics and work well on the maps. With mass of 5, 36, 60 and 100 tons and engines of 150, 700 and 1500 horsepower I’m testing different variations of the engine and gearbox. The idea is to have an unified system of engine, gearbox, suspension that adapts to the specifications given like mass, horsepower, number of gears and engine type.
I’ll make a video next time exposing this variables and showing the differences.
I’ve tried several methods to create a vehicle suspension from rigid body joints, constraint actuators, forces with logic brick or python and probably a lot more just to get to a conclusion that what works best is using either the vehicle wrapper or a similar method with python using raycast.
But all depends how you want your vehicle physics to look like. So too help you with some shortcuts here are some resources you can look at:
pros: easiest way and you don’t need python or almost none
cons: the down side of using rigid body constraints is that “they are rigid bodies”, not soft bodies, so you can’t really control the wheels at high speeds as they become unstable and too bouncy, also the constraints are very dependent on the mass of the rigid bodies you are applying them, creating a very unpredictable behavior.
for vehicle wrapper check this tutorial (you can go more advanced if you look around in this forum)
pros: the most efficient method I found to use in blender game engine very few cpu usage, decent behavior.
cons: Complex to setup, at the moment you have to use lower than reality mass, usually below 300 or thing can go weird, and the worst for me was that I couldn’t find a way to keep the vehicle still while in a slop if I stop the vehicle, it tend to slide even with brakes on.
Still there are very nice uses for this method like this example.
Basically, the way you grab the vertices to pin to another object is to add a material to a face with the vertices you want to move and check for other vertices in the mesh that have the same position as those vertices.
Then, create a list with those vertices and you can now iterate on that list to, for example, move the vertices.
The way you will then move the vertices is up to you, in my case I use the wheels object to get the appropriate material with the vertices I want in the track object and move them along.
Here is a small tutorial with the method I used to move the vertices.
yes i know you are using ray cast for the wheels, idk how to program more than four.
check the link for raycast method on post 6. Raiderium is the author of that method, it’s very complex, I can’t explain it fully here, from raiderium files you can figure out how to do more than 4 wheels.
yes i do know you are just moving the verts of the track mesh and doing so along on a material but i still have no clue as to how you have it deforming a full track.
The way I’m moving the tracks is using the method in the blend file I send with the example, the verts just move up and down along with the wheel , they do not scroll around. For that i’m using a UVscroller.
This is a good tread to check for uvscroller:
smoking_mirror has a post with the code for the uvscroller in there.
So the tracks moving and deforming is a combination of both methods:
the vertices moving up and down method in the file I sent, imagine the bigger red object being the bottom part of the track and 2 wheels going up pulling the verts
the tracks moving around using the uvscroller giving the effect that it’s moving but it’s not
the track is parented to the tank base and move with the tank base the deformation is done using the pin verts method described.
When I have more time I’ll do a proper tutorial with a video, but 1st I want to make a working demo of the project.
Until then, I hope this at least gives you some clues on how to do it.
okay i got most of that, but still not understanding how to make the link between the wheels themselves and the track with the whole vert pins.
i mean the blend you uploaded was just a button making them rise which can be changed on each axis, but the tracks are obviously dependent on the wheels themselves which is what i am trying to figure out.