Unconfigured Ad Widget

تقليص

إعـــــــلان

تقليص
لا يوجد إعلان حتى الآن.

تحريك مدرعة او أي سيارة أو ...

تقليص
X
 
  • تصفية - فلترة
  • الوقت
  • عرض
إلغاء تحديد الكل
مشاركات جديدة

  • تحريك مدرعة او أي سيارة أو ...

    بمناسبة الحديث عن تنشيط المنتدى
    لقيت هذا الدرس في النت وحبيت أني أشارك بيكم

    One of the cool things about Maya is the ability to add attributes to objects. One trick is to use a curve as a control object and then add custom attributes to that curve. If you want to get fancy, you can make a curve in Illustrator and import it into Maya.


    Image 1 -- Arrow created in Illustrator
    Image 2 -- Stand in geometry
    with control curves

    I created this arrow in Illustrator and imported it as an EPS. I am going to use this as a control object for the main body of the vehicle I am working on.

    One good thing about using curves is that you can lock all the attributes of the geometry and set the object selection masks to curves. That way you can only select the curves and not worry about disrupting the geometry. By using the connection editor, you can set multiple pivot points for groups wired into the control curves. For example: The jeep has a canon on top that rotates on three axis but each axis needs a different pivot point. By using nurbs circle as a control object this is easy to achieve.


    Image 3 -- Barrel rotation setup
    Image 4 - Barrel pivots up and down
    It might be hard to tell from the images but the barrel has a different pivot point for the X and Z rotations. Now if we pivot the curve in Y, it easier to see the different pivot for that rotation.


    Image 5 -- Entire base pivots

    A little planning is needed with how the cannon hierarchy is developed. In this case, start with the cannons base and group it. This group node will be the root node of the cannon hierarchy. Set the pivot for the cannon base group to where you want the Y axis to rotate. Group the cannon barrel and parent that group to the cannon base group. You don’t have to group the geometry but I find it better to do it this way as opposed to working directly with cannon geometry. It helps when you have a lot of complicated, small sections of geometry. I then grouped that group again so now I have a series of three groups for the cannon, the base group, the barrel X rotate group, and the barrel Z rotate group. Set the pivots for each group so each rotates around the correct axis.


    Image 6 -- Actual cannon and base geometry

    Now with the connection editor we’ll wire up the cannon groups to the cannon control curve. On the left side, load the cannon control curve. On the right side, load up the cannon base group. Connect the rotate Y on the cannon control curve to the cannon base group. Next load the barrel Z rotate group and connect the Z rotation. Do the same for the barrel X rotate group. So now by just selecting the one curve you can rotate the cannon three different ways. I also added attributes to the curve to allow for the barrels recoiling. The barrel recoil was handled with Set Driven Keys.

    Next we’ll tackle the suspension. At the tire, create a joint chain of three joints that will act as a shock. Add an IK Handle to the joint chain so you can keep the tires on the ground independent of the vehicles body.


    Image 7 -- Tire joint chain

    I created a curve box around the tire. I have a MEL script for this:



    curve -d 1 -p 9.26493 1.180816 1.180816 -p 9.26493 1.180816 -1.180816 -p 6.903298 1.180816 -1.180816 -p 6.903298 1.180816 1.180816 -p 9.26493 1.180816 1.180816 -p 9.26493 -1.180816 1.180816 -p 6.903298 -1.180816 1.180816 -p 6.903298 1.180816 1.180816 -p 6.903298 1.180816 -1.180816 -p 6.903298 -1.180816 -1.180816 -p 6.903298 -1.180816 1.180816 -p 9.26493 -1.180816 1.180816 -p 9.26493 -1.180816 -1.180816 -p 6.903298 -1.180816 -1.180816 -p 6.903298 1.180816 -1.180816 -p 9.26493 1.180816 -1.180816 -p 9.26493 -1.180816 -1.180816 -k 0 -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -k 9 -k 10 -k 11 -k 12 -k 13 -k 14 -k 15 -k 16 ; xform -cp;






    This script (I got this script from Chris Clay) will create a box shaped curve. I scaled and translated it so it fit around the tire. I then did a freeze transformations on it and moved its pivot point to the bottom center of the box curve. I named the curve WheelCtl. I grouped all of the tire elements and parented this group under the WheelCtrl curve. I then added a Point Constraint from the IK Handle to the WheelCtrl curve, so that when I move the WheelCtrl, the IK Handle moves with it.


    I grouped the root joint and parented that group to the main body group of the vehicle. This way, you could animate the body of the car but the wheels will stay in contact with the ground.

    For body control setup, I created an arrow curve in Illustrator and imported it into Maya as an EPS. I scaled it, rotated, and translated it into position at the front of the vehicle, and froze its transformations. Then using the connection editor, I connected the Y rotate to the twist attribute of the IK handle of the WheelCtrl curve. I then connected the twist attribute of the IK Handle to the Y rotate attribute of the WheelCtrl curve. This is so that when I rotate the BodyCtrl curve in Y, the front wheels will rotate in Y. I only did this for the front wheels because the rear wheels only spin, they don’t turn.


    Image 8 -- Front wheel setup

    I took the main body geometry group and connected all of its translate attributes to the BodyCtrl curve so that when I moved the BodyCtrl curve, the body geometry would move also. I also wired up the body Rotate X and Z to the same attributes on the BodyCtrl curve. Just by animating the body ctrl curve, the vehicle would bounce and sway and turn its front wheels. I then added custom attributes for the front and rear wheel spin. Then for each tire group I added the following expression:





    l_FrontWheelGrp.rotateX=((frame)*31)*BodyCtrl.FrontWheelSpin;






    This shows that the left, front wheel group will rotate around the X axis based on the value of the FrontWheelSpin attribute. The higher the value in the wheelspin attribute, the more the tire spins. If the value is set to zero, the tire doesn’t spin. This way proved to be flexible enough for the animators and worked better than an expression that would automatically rotate the tire based on how far the vehicle was translated. The 31 is just a multiplier I came up with that gave the results I wanted, plus it is a prime number doesn’t contain a multiple of 360.


    Next I added a control to get the wheels to act like they were connected through as axel. First I grouped the control curves for the front two wheels and centered the pivot for that group to get the needed rotations. I created a half circle shaped control curve then I just piped the rotation attributes from the group into the new control curve.


    Image 9 -- Axel control curve

    Lastly I created a box curve and scaled and translated it to fit around the entire vehicle. I grouped all of the other control curves and geometry groups to this so I could move the entire vehicle just by moving and rotating this main control curve. Part of the nice thing about using curves is that you can assign them to different layers, with the layers having different colors assigned to them, making it easier to tell what those curves do. For example, you might want to assign all the right hand controls one color and all the left hand controls another color. Another advantage is that curves are a lot easier to grab then a lot of different handles or locators.



    What is beyond the imagination MAYA
يعمل...
X