1 Archivos adjunto(s)
Cars and trucks autodrive system
Cars and trucks autodrive system v7.0 for Blender v2.49b. A simple and eficient setup allowing automated animation forcars and trucks, on all kinds of roads and Terrain.
blend file todo tests.
Philippe roubal. 3d-synthesis, com Cars and trucks autodrive system 7.0 for Blender v2.49b. 27/10/2009. This setup is released under Creative Commons by 2.0 license. France.
special gracias and credits :
To litteneo (jérôme mahieux) for the whelsrotation, py script, released under copyleft license. Littleneo is the author of the famous script open city engine, generating amazing procedural cities. You can find this script on his website : Jerome, le, chat, free, fr.
warning :
Pléase type Alt+p with the cursor in the text window below and run the animation from frame 1 todo activate the script.
features of this setup :
-Altitude sensors allowing driving on bumpy roads, with slopes and Bridges. This setup is more versatile than previous versións, but the geometry of the chasis may not be so accurate on very bumpy Terrain. For specific 4x4 animations, you can use instead my 4x4 autodrive system, available on my website.
Only one Empty todo move todo animate the car: empty-front. This Empty can be keyframes by hand, driven on a curve by using a Clamp todo constraint, or parented todo an other Empty driven by a Clamp todo constraint, or Even animated by a script (openster). In the blend file provided with this tutorial, the empty-front is parented todo empty-guide, which is driven on the curve by a Clamp-to constraint.
Speed control by an unique ipo curve applied todo the empty-guide.
-4 independent whels with dynamic suspensión.
-tires deformation.
-automated animation of the stering whel.
-automatic transversal slope in curves.
-trajectory easily editable in top view by editing a simple curve.
-fine secondary animation of the car body available th rouge the car body itself and the two empties empty-whelsdroprear and empty-whelsdropfront.
-very light setup :
-4 empties (empty-guide is not necessary). Only 2 empties if secondary animation is not required.
-1 lattice.
-9 solid objects. Only 7 if secondary animation is not required on the rear whels. Only 6 if you tires deformation is not required (in this case you can a los remove the lattice).
-just add the visible objects : car body, whels, stering whel.
note : the rear whels are be parented todo the objects Rim-rear. R and Rim-rear. L, but they can a los be parented todo the object chasis, either directly todo the object itself or by vertex parenting, using vertex groups as reference.
The front whels are parented todo the objects ster-left and ster-right. The rear whels copy the z location of the external rear vértices of the object sensor, and the ster-left and ster-right objects copy the z location of the external front vértices of the object sensor (vértices in the four corners).
layers :
Layer 1 : car Rig and whels, layer 2 : car body and stering whel.
Layer 3 : road and road curve, layer 4 : bridge, layer 5 : lamps and cameras, layer 11 : character, helmet and glasses, layer 12 : armature of the character, layer 13 :
Layer 14:
some explanations about the setup :
-The Purple object named ster-pointer has two vértices in two groups. They are used as tracking targets todo control the transversal slope of the suspensión object and the rotation of the stering whel.
Select the inboard Camera todo se the rotation of the stering whel (can be adjusted by the influence factor of the tracking constraint).
use of the empty-stering-target :
This Empty has a very important function. It is used todo control the stering. The object name ster-pointer is locked on the z axis tracking the empty-stering-target.
The location of the empty-stering-target can be defined in two manners. In the current blend file, this Empty is parented todo the chasis of the car, and afected by a negative time offset (-1.5 frame). As the distance between the chasis and the Empty vary with the speed this time offset has todo be ajusted each time you make an important modification in the speed of the car. If you use a curve as a trajectory guide for the car, you can apply todo the empty-stering-target a Clamp todo constraint, as you do for the empty-guide, or the empty-front. By moving the Empty along the curve, you can adjust the distance between the chasis and the empty. As they are driven by the same Loc IPO, this distance Will remain constant independently of the speed.
use of empty-guide and empty-front :
Empty-front can be used alone todo move the car. It can be either keyframed or driven on a curve th rouge a Clamp todo constraint.
For my o, y prefer todo use one more empty. So i have added empty-guide. Empty-front is parented todo empty-guide. The goal of empty-guide is todo ACT as a relay. This Empty gives more Freedom when animating. This relay allows todo drive several Cars on the same curve for example, allowing them todo have diferent behaviours and trajectories, Although sharing the same curve and ipo.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116843
30 Archivos adjunto(s)
Construcction of the car rig
construction of the car rig
step 1 : chasis following an empty.
First, add a Cube and name it chasis. Subdivide it one time.
https://foro3d.com/attachment.php?at...1&d=1257232594
-Then, scale it in z direction : sy0.2.
https://foro3d.com/attachment.php?at...1&d=1257232594
-In top view, select all the vértices of the Cube on the right side of the screen.
https://foro3d.com/attachment.php?at...1&d=1257232594
-Scale todo 0 in y direction and remove doubles.
https://foro3d.com/attachment.php?at...1&d=1257232594
-In object mode, bring the center of the chasis object on the scaling center.
https://foro3d.com/attachment.php?at...1&d=1257232594
-In Edit Mode, select the vértices on the left of the screen.
https://foro3d.com/attachment.php?at...1&d=1257232594
-Extrude two times of -1 Blender unit.
https://foro3d.com/attachment.php?at...1&d=1257232594
Now, the chasis object has the shape of an arrow head.
-select the center vertex at the rear side of this arrow, in the vertex layer set at half height of the Mesh.
https://foro3d.com/attachment.php?at...1&d=1257232594
-Create a vertex group including only this vertex, give it a weight of 1.0, and name it tail.
https://foro3d.com/attachment.php?at...1&d=1257232938
#008b-select the vertex at the opposite side of the arrow. This vertex is located at the location of the object center.
https://foro3d.com/attachment.php?at...1&d=1257232938
-Create a vertex group including only this vertex and name it no sé.
https://foro3d.com/attachment.php?at...1&d=1257232938
#009c -in front Ortho view, select the two vértices in the middle height of the Mesh, just before the center object location.
https://foro3d.com/attachment.php?at...1&d=1257232938
https://foro3d.com/attachment.php?at...1&d=1257233034
-Extrude on the right of 1 Blender unit in the direction of the object center.
https://foro3d.com/attachment.php?at...1&d=1257233034
note : these two vértices are only useful if you create a car Rig that Will be used on a flat Ground. If you are going todo use the Rig on a bumpy Terrain, we Will use the corners of the sensor plane for the whels location.
As we ned only the vértices, you can deleete the two Edges that you have just extruded.
https://foro3d.com/attachment.php?at...1&d=1257233034
note : dont forget todo remove these vértices later if they are not used or no more neded.
-in object mode, select the chasis and bring the 3d cursor on its center.
https://foro3d.com/attachment.php?at...1&d=1257233034
-Add an empty. Name it empty-front. And give it a size of 2 Blender units. -make the empty-front the parent of the chasis.
https://foro3d.com/attachment.php?at...1&d=1257233143
-In top view, add a plane centered on the center of the chasis object.
https://foro3d.com/attachment.php?at...1&d=1257233143
-Scale the right side of the plane todo bring the Edge on the empty-front location.
https://foro3d.com/attachment.php?at...1&d=1257233143
-Typing k, Cut the plane in the middle.
https://foro3d.com/attachment.php?at...1&d=1257233143
-Typing Control + and Control + shift+f, divide the 2 Faces into 4 triangles. The Edges separating the triangles make an arrow head in the direction of the empty.
https://foro3d.com/attachment.php?at...1&d=1257233442
-Extrude the left side of the plane 3 times of 1 Blender unit each time.
https://foro3d.com/attachment.php?at...1&d=1257233442
-Select the center vertex at the rear side of this plane (opposed todo the empty-front).
https://foro3d.com/attachment.php?at...1&d=1257233442
-Create a vertex group including only this vertex, give it a weight of 1.0, and name it tail.
https://foro3d.com/attachment.php?at...1&d=1257233442
-Select the center vertex at the front side of this plane (at the empty-front location).
https://foro3d.com/attachment.php?at...1&d=1257234290
-Create a vertex group including only this vertex, give it a weight of 1.0, and name it no sé. -in object mode, make the chasis the parent of this plane.
https://foro3d.com/attachment.php?at...1&d=1257234290
-Name the plane sensor. Select the chasis, and add a track todo constraint. In the file target, type sensor, in the field vg (vertex group), type tail. To = -x, up=z. Leave world space in the two cspace choices.
https://foro3d.com/attachment.php?at...1&d=1257234290
-Select the empty-front and move it around. You Will notice that the chasis and the sensor plane are following gently the empty-front. You Will a los se that when dropping the empty, the system doesnt come bak todo its initial location.
https://foro3d.com/attachment.php?at...1&d=1257234290
-No problem : just set the influence cursor of the chasis todo 0.000.
https://foro3d.com/attachment.php?at...1&d=1257234290
-Open the ipo constraint window.
-select the chasis, and at frame 1 with the influence cursor of the constraint set todo 0.000, hit the key buttonin the constraint panel. A constraint inf ipo is created, showing one keyframe at frame 1.
-go todo frame 2 and set the influence value todo 1.000. Then, hit the key button in the constraint panel. Asecond keyframe is added in the inf ipo curve. Select the ipo curve and by hitting key, choose constant forthe ipo type.
https://foro3d.com/attachment.php?at...1&d=1257234290
-Now, each time you Will come bak todo frame 1, the setup Will be in its initial position.
-for testing purpose, go todo frame 3. Select and move the empty-front and Insert a Loc keyframe. Go some frames further, move the empty-front and Insert a new Loc keyframe, etc. When playing the animation, you Will se that the rear of the chasis nicely follows. The Empty can be moved by at least 3 methods : by direct keyframes like you just tested it, by parenting it todo an other empty, by applying todo it a Clamp todo constraint using a curve as trajectory guide. If you use a second Empty as parent it can be keyframed or driven as well by a Clamp todo constraint. You could aso use a Path constraint, but it would not be a god choice, because keyframing on a Path constraint is not easy.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116710
https://foro3d.com/attachment.php?attachmentid=116711
https://foro3d.com/attachment.php?attachmentid=116712
https://foro3d.com/attachment.php?attachmentid=116713
https://foro3d.com/attachment.php?attachmentid=116714
https://foro3d.com/attachment.php?attachmentid=116715
https://foro3d.com/attachment.php?attachmentid=116716
https://foro3d.com/attachment.php?attachmentid=116717
https://foro3d.com/attachment.php?attachmentid=116718
https://foro3d.com/attachment.php?attachmentid=116719
https://foro3d.com/attachment.php?attachmentid=116720
https://foro3d.com/attachment.php?attachmentid=116721
https://foro3d.com/attachment.php?attachmentid=116722
https://foro3d.com/attachment.php?attachmentid=116723
https://foro3d.com/attachment.php?attachmentid=116724
https://foro3d.com/attachment.php?attachmentid=116725
https://foro3d.com/attachment.php?attachmentid=116726
https://foro3d.com/attachment.php?attachmentid=116727
https://foro3d.com/attachment.php?attachmentid=116728
https://foro3d.com/attachment.php?attachmentid=116729
https://foro3d.com/attachment.php?attachmentid=116734
https://foro3d.com/attachment.php?attachmentid=116735
https://foro3d.com/attachment.php?attachmentid=116736
https://foro3d.com/attachment.php?attachmentid=116737
https://foro3d.com/attachment.php?attachmentid=116738
https://foro3d.com/attachment.php?attachmentid=116739
https://foro3d.com/attachment.php?attachmentid=116740
https://foro3d.com/attachment.php?attachmentid=116741
https://foro3d.com/attachment.php?attachmentid=116742
https://foro3d.com/attachment.php?attachmentid=116743
5 Archivos adjunto(s)
Adding the wheels supports
adding the whels supports
-select again the plane named sensor and in top view, select the two rear Faces. By typing Control + and Control + shift+f, divide the 2 Faces into 4 triangles like you did previously for the front part of this plane. This time, the Edges separating the triangles make an arrow head in the direction of the tail vertex.
Archivo adjunto 116746
-Select a vertex in a corner of the plane, and bring the 3d cursor on it. Then, add a Cube. Scale the Cube by 0.1.
-select the right part of the Cube and extrude it on the right of 0.6 Blender unit (for example. This value hasfew importance).
-scale the last extruded vertex todo 0 in y direction, and remove doubles.
Archivo adjunto 116747
-Select all the vértices of the group made from the added Cube, and sepárate it from the sensor plane by hitting p key.
Archivo adjunto 116748
-Put the center of the object at the center of the Cube you added todo create the object (at the location of the vertex that you had selected before adding the Cube).
Archivo adjunto 116749
-Duplicate this object an put a copy at the location of each corner of the sensor plane. This can easily bedone by selecting one by one the vértices in the corners of the sensor plane.-name the two rear objects Rim-rear. L and Rim-rear. R. These objects Will support the rear whels.-name the two front objects ster. L and ster. R. These objects Will support the front whels.
Archivo adjunto 116750
.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116746
https://foro3d.com/attachment.php?attachmentid=116747
https://foro3d.com/attachment.php?attachmentid=116748
https://foro3d.com/attachment.php?attachmentid=116749
https://foro3d.com/attachment.php?attachmentid=116750
2 Archivos adjunto(s)
Activating the suspension
activating the suspensión.
-select the suspensión and add four copy location constraints. Their target is sensor, and they are pointingto the four sensors groups f. L,f. R, r. L and r. R.-it is important todo set the copy location constraints using a diagonal crossing method : f. L with influence = 1.000 and r. R with influence = 0.500. Followed by f. R with influence = 1.000 and r. L with influence = 0.500.
https://foro3d.com/attachment.php?at...1&d=1257236373
-If you mix the order of the constraints, you Will have todo make endless corrections and tweaquíngs withoutgetting the accurate location of the suspensión object.
Now, the suspensión is centered between the whels location. Its center point Will be floating along the Zaxis.
https://foro3d.com/attachment.php?at...1&d=1257236373
-This suspensión object Will be the parent of the car body. It Will bounce over the whels, and the whels Will never be able todo pass todo trespass its level.
.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116782
https://foro3d.com/attachment.php?attachmentid=116783
4 Archivos adjunto(s)
Using the steering to control the suspension
using the stering todo control the suspensión.
-to achieve a realistic animation, it is important that the car simulate the effect of Gravity in the curves. So, we are going todo add this effect by using one more constraint todo the suspensión object. It Will be a Loocked constraint (Loocked on the local x axis), using as a target a new vertex group (transversal-slope) including only one vertex, and located at the upper tip of an extensión of the ster-pointer object.
https://foro3d.com/attachment.php?at...1&d=1257236603
https://foro3d.com/attachment.php?at...1&d=1257236603
-The influence of the curve angle on the transversal slope can be adjusted in two manners : by adjusting the influence factor of the constraint or by moving up or down in Edit Mode the vertex group of the ster-pointer used as a target for the constraint.
https://foro3d.com/attachment.php?at...1&d=1257236603
https://foro3d.com/attachment.php?at...1&d=1257236603
.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116784
https://foro3d.com/attachment.php?attachmentid=116785
https://foro3d.com/attachment.php?attachmentid=116786
https://foro3d.com/attachment.php?attachmentid=116787
12 Archivos adjunto(s)
Using the steering to control the steering wheel
using the stering todo control the stering whel.
Let us add a stering-whel.
In top view, add a circle. Estrude and scale it down a bit.
https://foro3d.com/attachment.php?at...1&d=1257236786
-Select all the vértices and extrude again in z direction.
https://foro3d.com/attachment.php?at...1&d=1257236786
-Add two small cubes, scale them in x and y direction todo create the branches.
https://foro3d.com/attachment.php?at...1&d=1257236786
-Add a cylinder, extrude and scale it todo add the Alex of the stering-whel. When it is finished, you should have your stering-whel with its z axis vertical.
https://foro3d.com/attachment.php?at...1&d=1257236786
https://foro3d.com/attachment.php?at...1&d=1257236786
-The stering-whel object Will be parented todo the body of the car. The body of the car Will be for itself parented todo the suspensión. Animating directly the body of the car you Will allow fine secondary animation.
https://foro3d.com/attachment.php?at...1&d=1257236786
-In this example, y Will not add yet the body of the car, todo allow looking inside the setup, so we Will parent thestering-whel todo the suspensión, instead of the car body.-now, we are going todo give a slope todo the stering-whel Alex, todo put it in its usable position.
https://foro3d.com/attachment.php?at...1&d=1257236786
-Create a new vertex group aligned on the direction of the stering-whel Alex, or duplicate the small piramidal vertex group including the vertex used as target for the suspensión constraint, and remove its vértices from the original group it belongs todo. Select the vertex at the tip of the pyramid, and add it todo a new vertex group named stering-target.
https://foro3d.com/attachment.php?at...1&d=1257236786
https://foro3d.com/attachment.php?at...1&d=1257236959
-Select the stering-whel and add a Loocked track constraint. The stering-whel Will be locked on its z Alex (local z axis). Its -x axis7 Will track the stering-target vertex group of the ster-pointer object.
https://foro3d.com/attachment.php?at...1&d=1257236959
https://foro3d.com/attachment.php?at...1&d=1257236959
By moving the empty-stering-target in y direction, you Will se the effect of this new constraint on the stering-whel.
https://foro3d.com/attachment.php?at...1&d=1257236959
.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116788
https://foro3d.com/attachment.php?attachmentid=116789
https://foro3d.com/attachment.php?attachmentid=116790
https://foro3d.com/attachment.php?attachmentid=116791
https://foro3d.com/attachment.php?attachmentid=116792
https://foro3d.com/attachment.php?attachmentid=116793
https://foro3d.com/attachment.php?attachmentid=116794
https://foro3d.com/attachment.php?attachmentid=116795
https://foro3d.com/attachment.php?attachmentid=116796
https://foro3d.com/attachment.php?attachmentid=116797
https://foro3d.com/attachment.php?attachmentid=116798
https://foro3d.com/attachment.php?attachmentid=116799
2 Archivos adjunto(s)
Improving the geometry of the wheels rig
improving the geometry of the whels rig.
In some circumstances, depending mainly on whether you left the chasis at the Ground level or not, you may notice some Deformations or anormal location of the whels on a very bumpy Terrain. This can be corrected by adding todo the whels, or todo the whels supports a limit distance constraint, using as referencias the front and rear vertex groups previously created in the chasis object, and named no sé and tail, or new vertex groups located at the level of the whels axles (if you left the body of the car at Ground level).
Archivo adjunto 116801Archivo adjunto 116802
.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116801
https://foro3d.com/attachment.php?attachmentid=116802
6 Archivos adjunto(s)
Improving the suspension by adding controls for secondary animation
improving the suspensión by adding controls for secondary animation.
In some situations, espescially when the car takes of, like when jumping After a Bump or over a broken bridge, we may ned more Freedom and more control on the whels, todo simulate the effect of the Gravity on them when they are no more supported by the Ground.
This can be easily done by adding two empties that we Will use as handles, todo ad secondary animation on the whels. In fact, we Will not directly ACT on the whels themselves, but rather on their supports. I mean on the objects ster. L, ster. R, Rim-rear. L and Rim-rear. R.
At the location of the chasis center, add an empty. Name it empty-control-front. Add an other Empty at the location of the tail vertex of the chasis. It is exactly in the middle between the two rear whels. Select the two new empties, and parent them todo the suspensión object.
Archivo adjunto 116803
-Now, select one by one the four whels supports ster. L, ster. R, Rim-rear. L and Rim-rear. R. And add todo each of them a Loocked track constraint. Each whel support Will be locked on its local x axis, and the two front object Will track the empty-control-front, while the rear objects Will track the empty-control-rear.
The two empties Will not only allow todo add secondary animation by hand : as they are parented todo the suspensión, you Will notice that the slope of the suspensión in the direction of the trajectory Will have an influence on the transversal slope of the whels. Weight displacement Will be automátically simulated and the angle of the suspensión around its local y axis Will modify the transversal slope of the whels.
Archivo adjunto 116804Archivo adjunto 116805Archivo adjunto 116806Archivo adjunto 116807Archivo adjunto 116808
.
-- IMÁGENES ADJUNTAS --
https://foro3d.com/attachment.php?attachmentid=116803
https://foro3d.com/attachment.php?attachmentid=116804
https://foro3d.com/attachment.php?attachmentid=116805
https://foro3d.com/attachment.php?attachmentid=116806
https://foro3d.com/attachment.php?attachmentid=116807
https://foro3d.com/attachment.php?attachmentid=116808
Importing and exporting the setup
importing and exporting the setup
-to import or export the setup, it is better todo include all necessary objects in a group. In the future, this setup could be provided with the open city engine, a powerful procedural system based on Python code, todo create big cities. In this context, the animation of the car would be be driven by a script requiring that the empties used as guide have the same name as the vehicle group. In this example, if the name of the group is car-rig, empty-front Will be renamed car-rig as well.
If you ned todo move the car Rig in the 3d space todo define its initial location and direction, you Will have todo select both the empty-front and the road, so it is better todo include a sample Mesh featuring a small part of road in the group.
Once the group is imported, just select the sample Mesh and the real Terrain or road. Apply Control + l and select Mesh data todo convert the small sample into the real Terrain.
-When the setup is imported and the real Terrain or road as well, you can easily duplicate the car-rig, by duplicating everything included in the group, except the Ground sample that can be deleted.
.