playMaker

Author Topic: How Can I rotate a bone at Runtime with Mecanim ?  (Read 2746 times)

Tug69

  • Playmaker Newbie
  • *
  • Posts: 7
How Can I rotate a bone at Runtime with Mecanim ?
« on: January 15, 2016, 10:18:29 AM »
Hello Everybody I have a little problem !!

I will try to explain it with the basic vocabulary I have, pardon me.

I Have a bot that is a marksman with a bow, he is facing the player.
When the player climb a bit the bot do not aim upward.
I want the spine to rotate for the hands/head/body can shot an arrow to the player by aiming at the right angle, like an IK goal for a spine.

I have already used IK hands/feet and that worked very well but here I think I need a root bone rotation and I failed at finding how to use it.

I tried stuff like "Set Animator Look At" but nothing worked.
My Bot Animator have IK Pass box Checked.
My game is a 2.5D Side Scroller

Any tips ?

Thanks for reading.
« Last Edit: January 16, 2016, 07:38:16 AM by Tug69 »

Tug69

  • Playmaker Newbie
  • *
  • Posts: 7
Re: How Can I rotate a bone at Runtime with Mecanim ?
« Reply #1 on: January 16, 2016, 08:48:31 AM »
I upgaded to Unity 5.3xx and I re downloaded the "Animator Proxy" from Ecosystem (must have been updated) and the "Set Animator Look At" is now working.

rik

  • Full Member
  • ***
  • Posts: 246
Re: How Can I rotate a bone at Runtime with Mecanim ?
« Reply #2 on: January 16, 2016, 12:50:24 PM »
good job i thought you would use ik system from asset store.
can you share how you set up ik in your game for aim ?

Tug69

  • Playmaker Newbie
  • *
  • Posts: 7
Re: How Can I rotate a bone at Runtime with Mecanim ?
« Reply #3 on: January 16, 2016, 03:00:05 PM »
Hello Rik.

I will share how I do it when I will have it done.

After I have found how to have "Set Animator Look At" working I spent my time researching a solution for another problem with the root motion of a robot in Generic Rig (I will probably solve it by setting animations in "in place mode" xD )

Monday I will work on it and as soon as I find a good way for this to work I will tell you !

Bye.
« Last Edit: January 16, 2016, 03:11:27 PM by Tug69 »

rik

  • Full Member
  • ***
  • Posts: 246
Re: How Can I rotate a bone at Runtime with Mecanim ?
« Reply #4 on: January 16, 2016, 03:47:51 PM »
ok sure let me know

Tug69

  • Playmaker Newbie
  • *
  • Posts: 7
Re: How Can I rotate a bone at Runtime with Mecanim ?
« Reply #5 on: January 20, 2016, 06:48:22 AM »
Ok so, I had hard time to do it but I have a beginning.

So I put a Empty GameObject (The IK Goal for the Bot) children of my hero GameObject.
The Bot is Firing an arrow so it does not go in a straight line plus the bot is upper than the player so the IKGoal really need to be offset depending on where the player is and if he is running or standing still.

(I also used other little things to have the arrow well placed (z=0),  to align the arrow when I add the force to throw it)

As I do not really know about what you are seeking I don't really know what to say.
If you want to know more feel free to ask, I'll can maybe do a video if needed and when I will have finished, in the case you want to see every little things I did for it to works.


Veuillez agréer des bisous !
« Last Edit: January 20, 2016, 07:41:53 AM by Tug69 »