Jump to content
Sign in to follow this  
super-truite

wheel rotation model.cfg

Recommended Posts

I was supposed to deliver and present a little tutorial, tonight to my team, on how to make a template car. At the moment I have made a non physx car and I am stuck at the last step I wanted to show: make the rotation animation of the front wheels (which are steerable) . The issue I have is the following: when I change the direction of the wheel and then launch the rotation of the wheel animation, the axis is not right. My last try:

class Rotation;
class CfgSkeletons
{

   class REV1_veh
   {
       skeletonBones[]=
       {
           "volant",
           "",
           "wheel_1_2",
           "",
           "wheel_1_1",
           "",
           "wheel_2_1",
           "",
           "wheel_2_2",
           "",
           "volant"

       };
   };
};
class CfgModels
{

   class veh
   {
       isDiscrete = 1;
       sectionsInherit="";
       sections[]=
       {


       };
       skeletonName="REV1_veh";
       class Animations
       {


           class TurnFR
           {
               type="rotationY";
               source="drivingWheel";
               selection="wheel_1_2";
               axis="";
               memory="false";
               animPeriod=0;
               sourceAddress="loop";
               minValue="rad -180";
               maxValue="rad +180";
               angle0="rad +90";
               angle1="rad -90";
           };
           class TurnFL: TurnFR
           {
               selection="wheel_1_1";
              // axis="wheel_1_1_axis";

           };
           class DrivingWheel
           {
               type="rotation";
               source="drivingWheel";
               selection="volant";
               begin="osaVolantZac";
               end="osaVolantKon";
               memory="false";
               animPeriod=0;
               minValue=-1;
               maxValue=1;
               angle0=-8;
               angle1=8;
           };

           class FR
           {
               type="rotation";
               source="wheel";
               selection="wheel_1_2";
               begin="wheel_1_2_axis2";
               end="wheel_1_2_axis2_1";
               memory="false";
               sourceAddress="loop";
               minValue=0;
               maxValue=1;
               angle0=0;
               angle1="rad -360";
           };
            class FL: FR
           {
               selection="wheel_1_1";
               begin="wheel_1_1_axis2";
               end="wheel_1_1_axis2_1";
           };
           class RR
           {   
               type="rotationX";
               source="wheel";
               selection="wheel_2_2";
               axis="";
               memory="false";
               animPeriod=0;
               sourceAddress="loop";
               minValue=0;
               maxValue=1;
               angle0=0;
               angle1="rad -360";

           };

           class RL: RR
           {
               selection="wheel_2_1";
           };

       };
   };
};  

The problematic piece is for instance the FR class. The logic is the following: I defined 2 points ("wheel_1_2_axis2" and "wheel_1_2_axis2_1") to define the oriented rotation axis ands those points are included in the selection wheel_1_2 which is rotated via the anim "TurnFR". So in principle, the rotation axis matches the symmetry axis of the wheel at any time, which is what I want. Yet it doesn't work, so my logic must be not so logic after all :).

Any ideas?

PS: if you need a closer look at the model to understand: http://www.mediafire.com/download/4shb6a4n7bmibhe/REV1_veh.rar

  • Like 1

Share this post


Link to post
Share on other sites

"volant",

"",

"wheel_1_2",

"",

"wheel_1_1",

"",

"wheel_2_1",

"",

"wheel_2_2",

"",

"volant"

Skeleton is ALWAY defined in pairs. The last "volant" doesn't have a pair, but that aside, I dont see why its there a second time.

Share this post


Link to post
Share on other sites

Thanks, I just added it because I had a bug with the last wheel (because I was precisely forgetting its pair :)).

It does not relate to my problem though. I guess the issue comes from the fact that I try to rotate the selection with an axis present in this very same selection. OOps, silly me, I think I know what is wrong...I'll report back

---------- Post added at 04:32 PM ---------- Previous post was at 03:33 PM ----------

Still no joy... My idea was to separate the axis in a different selection, Link this selection to the wheel via the skeleton, but in the end it's the same problem...

Model.cfg:

class Rotation;
class CfgSkeletons
{

   class REV1_veh
   {
       skeletonBones[]=
       {
           "volant","",
           "wheel_1_2","",
           "wheel_1_1","",
           "axis1_1","wheel_1_1",
           "wheel_2_1", "",
           "axis1_2","wheel_1_2",
           "wheel_2_2",""

       };
   };
};
class CfgModels
{

   class veh
   {

       skeletonName="REV1_veh";
       class Animations
       {


           class TurnFR
           {
               type="rotationY";
               source="drivingWheel";
               selection="wheel_1_2";
               axis="";
               memory="false";
               animPeriod=0;
               sourceAddress="loop";
               minValue="rad -180";
               maxValue="rad +180";
               angle0="rad +90";
               angle1="rad -90";
           };
           class TurnFL: TurnFR
           {
               selection="wheel_1_1";

           };
           class DrivingWheel
           {
               type="rotation";
               source="drivingWheel";
               selection="volant";
               begin="osaVolantZac";
               end="osaVolantKon";
               memory="false";
               animPeriod=0;
               minValue=-1;
               maxValue=1;
               angle0=-8;
               angle1=8;
           };


         /*  class FR
           {
               type="rotationX";
               source="wheel";
               selection="wheel_1_2";
               axis = "axis1_2";
               memory="false";
               sourceAddress="loop";
               minValue=0;
               maxValue=1;
               angle0=0;
               angle1="rad -360";
           };
            class FL: FR
           {
               selection="wheel_1_1";
               axis="axis1_1";
           };*/

          class FR
           {
               type="rotation";
               source="wheel";
               selection="wheel_1_2";
               begin="axis1_2_1";
               end="axis1_2_2";
               memory="false";
               sourceAddress="loop";
               minValue=0;
               maxValue=1;
               angle0=0;
               angle1="rad -360";
           };
            class FL: FR
           {
               selection="wheel_1_1";
               begin="axis1_1_1";
               end="axis1_1_2";
           };
           class RR
           {   
               type="rotationX";
               source="wheel";
               selection="wheel_2_2";
               axis="";
               memory="false";
               animPeriod=0;
               sourceAddress="loop";
               minValue=0;
               maxValue=1;
               angle0=0;
               angle1="rad -360";

           };

           class RL: RR
           {
               selection="wheel_2_1";
           };

       };
   };
};  


Edited by super-truite

Share this post


Link to post
Share on other sites

If your trying to create the normal steering two front wheels then your steering axis must be Vertical two vertices that is all for the source drivingwheel

If you are experimenting with something well i cant see clear description sorry :).

however basic rule of thumb if you want something to follow a parent bone , make it so in the skeleton and ensure that part is also given same kind animation as the parent bone and source of course

Share this post


Link to post
Share on other sites

no Sealife, I don't try to make something original here :), just 2 regular front wheels! In the end, I gave up on my logic and copy pasted the front wheel piece of code from http://forums.bistudio.com/showthread.php?84585-Wheel-animation-animates-incorrectly/page4 and removing my mess with the dummy axis, it works. Here is the model.cfg:

class Rotation;
class CfgSkeletons
{

   class skeleton_veh
   {
       skeletonBones[]=
       {
           "volant","",
           "wheel_1_2","",
           "wheel_1_1","",
           "wheel_1_1",
           "wheel_2_1", "",
           "wheel_1_2",
           "wheel_2_2",""

       };
   };
};
class CfgModels 
{

   class veh 
   {

       skeletonName="skeleton_veh";
       class Animations
       {
         class FrontWheelR
           {
               type = "rotationX";
               source = "wheel";
               memory = "false";
               angle0 = "0";
               angle1 = "rad -360";
               maxValue = "1";
               minValue = "0";
               selection = "wheel_1_2";
               sourceAddress = "loop";
           };
           class FrontWheelL : FrontWheelR
           {
               selection = "wheel_1_1";
           };
           class FrontWheelRTurn
           {
               type = "rotationY";
               source = "drivingWheel";
               memory = "false";
               angle0 = "rad 35";
               angle1 = "rad -35";
               maxValue = "1";
               minValue = "-1";
               selection = "wheel_1_2";
               sourceAddress = "clamp";
           };
            class FrontWheelLTurn : FrontWheelRTurn
           {
               selection = "wheel_1_1";
            };

           class DrivingWheel
           {
               type="rotation";
               source="drivingWheel";
               selection="volant";
               begin="osaVolantZac";
               end="osaVolantKon";
               memory="false";
               animPeriod=0;
               minValue=-1;
               maxValue=1;
               angle0=-8;
               angle1=8;
           };

           class RR
           {   
               type="rotationX";
               source="wheel";
               selection="wheel_2_2";
               axis="";
               memory="false";
               animPeriod=0;
               sourceAddress="loop";
               minValue=0;
               maxValue=1;
               angle0=0;
               angle1="rad -360";

           };

           class RL: RR
           {
               selection="wheel_2_1";
           };

       };
   };
};  

I should be happy to see that it works, yet it seems really fishy to me that it does! I don't get how the game engine understands what axis the tire must rotate around. In "FrontWheelR" and "FrontWheelRTurn", the axis are just the x and y axis, but somehow, when we change direction (turning the wheel around the y axis), the x axis adapts and rotates as well.

The only explanation I can find at this hour of the night is that those axis are local to the selection and are not the global x and y axis of O2. Is this correct?

All the files for those interested (its a template (pink) model, not a beautiful rally car :)):

http://www.mediafire.com/download/x797e3op852n5ux/REV1_veh(2).rar

(some selection names are useless and will be used only later, for physx).

Share this post


Link to post
Share on other sites

if i understand correct

there is no need for axis on the turn of the wheel if the wheel is symetryical

the same for the wheel turn lft or right , however if you do ned an axis for offset pivotal reasons the axis is two vertical points not horizontal and this axis is named whateveryou like

axis ="nameofaxis";

see all this begin end etc in your config before thats not right remove and simply put two points and axis =" name of points";

if in doubt the A1 vehicle Mlods are avaiable and still relevant and can explain clear than my post lol ;)

the crux of your problem i believe you have been confused how the stering wheel is set up , the wheels themsleves are different and dont require the Bein and end axis define

Share this post


Link to post
Share on other sites

It's working with the model.cfg in my previous post.

I see know how to do it, but at the beginning I was trying to do it from scratch, for learning purpose and because I didn't find a good example right away. That is why it was not set up like you expected in my first posts, but I guess there are several ways of doing it. Anyway, thanks for the help!

Share this post


Link to post
Share on other sites
but I guess there are several ways of doing it.

No, not usually. After years of using O2 and even today getting stuck wasting DAYS trying to find an issue I can tell you the there is still plenty of WEIRDNESS in the tools.

As rule now, if I get stuck with weird animation problem (in Bulldozer) I completely close O2 and Bulldozer and restart the tools.

Amazing how many problems just .... disappear.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×