Home Unity

mechanical rigs in unity with rotation constraints?

AlecMoody
ngon master
Offline / Send Message
AlecMoody ngon master
I have a simple turret model I want rigged inside unity so that I can automatically track targets. The aiming is designed around a turn table + second pivot for elevation angle. Is there an easy way to make this work? FBX doesn't export any information about constraints and I can't find constraints anywhere in the UI.

Replies

  • SlyRipper
    Options
    Offline / Send Message
    SlyRipper polycounter lvl 6
    You can place a simple bone and rotate that bone within Unity. You could also rotate the object itself around it's pivot, just make sure it's a seperate mesh. There's a LookAt command within unity.
  • AlecMoody
    Options
    Offline / Send Message
    AlecMoody ngon master
    Hi SlyRipper,
    The turret doesn't work with a simple look at command since it needs two joints to orient itself. In order to aim it needs to rotate around two diffent constrained pivots. Y for the base, and local X + Y for the head.
  • Farfarer
    Options
    Offline / Send Message
    Get the position of the target, replace the Y component with that of the base's position. You now have it's target point without the up/down factor. Then use LookAt on the new position you've worked out.

    Then for the up/down looky bit, you want to get the angle between it's position and the target's position. Then rotate on the X asis (assuming it's X is the up/down bit's axle) until it points to it. There's probably something a bit more clever you could do for this, but I'm tired and it's been a while since I've messed with stuff like that :P
  • AlecMoody
    Options
    Offline / Send Message
    AlecMoody ngon master
    I got this working using a plugin in asset store:
    http://constraints.path-o-logical.com/
Sign In or Register to comment.