This topic contains 3 replies, has 2 voices, and was last updated by  Elzean 8 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33852

    Elzean
    Participant

    Hi,

    i couldn’t find a tutorial that explain the step to create a custom motor, is there something that could get me started ? I would like to use the third person motor used in the unity sample asset (the one with Ethan, a plane and a car). Do you have any suggestion on how i should proceed or if for some reason i shouldn’t use that motor with RAIN ?

    The sample asset can be found here : https://www.assetstore.unity3d.com/en/#!/content/14474

    Thanks !

    #33874

    Elzean
    Participant

    So i figure some stuff out and now just extends the MecanimMotor.

    I am trying to forward the rotation speed to mecanim . I don’t mean the value in the motor “RotationSpeed” which seems to just be a constant value unlike the “Speed” parameter. My mecanim setup need a “Turn” value from -1 to 1, i could figure some calculation out but i can’t find any variable that give me the rotation amount the motor is aplying to the Character. “TurnAngle” is always 0 and “RotationSpeed” is always 180.

    In the motor i have “Use root motion” and “Override root rotation” set to true. I prefer to use the RAIN rotation than the motion rotation as it was too much imprecise but i still would like to send mecanim the turn value to fake the rotation animation a bit.

    Thanks!

    PS: I tested RAIN a few years ago when it was still called “RAIN{one}” if i remember correctly, glad to see all the improvement that has been done!

    #33876

    prime
    Keymaster

    You can forward the Rotation (not the rotation speed) as a mecanim parameter. This won’t be a value from 0 to 1, but rather an absolute rotation in degrees.

    We’ve done the same thing you are trying to do - use RAIN for the actual turning but simulate it with the animation. We tend to use TurnAngle to do it. TurnAngle is the degrees remaining that the AI needs to turn to reach it’s facing destination. It tends to work pretty well and produces smooth animation. We often use 3 animations, a move straight, move turning 60 degrees, and move turning 120 degrees, blending between them based on turn angle.

    If you can’t change the animator and must put out a number between -1 and 1, I suggest using a CustomElement. A custom element could, on Act, look at the rotation on the AI.Kinematic and set a Mecanim parameter.

    #33881

    Elzean
    Participant

    I change the mecanim animator to use the TurnAngle and it works nicely now thx :)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.