playMaker

Author Topic: Mecanim IK and layers (solved)  (Read 6972 times)

Sheridah

  • Playmaker Newbie
  • *
  • Posts: 14
Mecanim IK and layers (solved)
« on: September 12, 2013, 04:34:47 AM »
Hi all,

I came across this video where I guy sort of explains how to work with layered animations. Is there anyway I can do this with help of Playmaker?

Thank you :)

 
« Last Edit: November 10, 2013, 02:57:50 AM by Sheridah »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mecanim IK and layers
« Reply #1 on: September 13, 2013, 03:58:09 AM »
Hi,

 Yes, Have you studied the examples on Mecanim on the playmaker wiki?

https://hutonggames.fogbugz.com/default.asp?W1031

bye,

 Jean

Sheridah

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Mecanim IK and layers
« Reply #2 on: September 13, 2013, 05:42:22 PM »
Yes I have but it doesn't explain the specific example of the videolink that I included. I want my character to touch walls when she comes in close proximity with her left or right hand.

thanks :)

Sheridah

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Mecanim IK and layers
« Reply #3 on: September 16, 2013, 08:09:36 AM »
Anyone?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mecanim IK and layers
« Reply #4 on: September 17, 2013, 02:32:11 AM »
Hi,

 actually, it's all there for you. In the IK example on PlayMaker samples, instead of manually turn on/off ik, you turn it on and off as the user gets close to a wall.

also, you only trigger IK for the arm in question, not for all limbs.

Approach this using small steps.

1: can you modify the IK example to only IK one arm, the rest would remain totally fine and under mecanim animation control
2: can you switch from one arm to the other. that is, you have two events, one to toggle IK on the right arm, and one to toggle IK on the left arm
3: can you trigger that event based on raycasting ( us a simple cube that you move around the character so that raycast finds it
4: can you moe the IK end effector on the raycast Hit position

if you can do all this, then you are set :) each of these steps are really manageabl. Howevr don't hesitate to ask question on these particular steps as you go, I'll assist.


 Bye,

 Jean

Sheridah

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Mecanim IK and layers
« Reply #5 on: September 20, 2013, 06:31:00 AM »
Thank you for breaking it into small digestable steps. I seem to get stuck at the raycasting part. I'm afraid that it will have significant impact on my performance since my game is already very heavy. Are there any other possible methods?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mecanim IK and layers
« Reply #6 on: September 20, 2013, 08:08:31 AM »
hi,

 not really, RayCasting is the way to go here. you only need two raycasting, one for each arm. It's not going to affect si much to your game perf.

 I would however definitly study why your game is slow, and use the profiler to improve what's affecting the perfs, maybe it's a shader, or the use of a method that can improved.

bye,

 Jean

Sheridah

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Mecanim IK and layers
« Reply #7 on: November 05, 2013, 09:46:17 AM »
So I decided to let the matter rest for a while since it was extremely frustrating and not working ;)

Yesterday I started working on it again and I've completed all the steps but I do have  a few issues:

4: can you move the IK end effector on the raycast Hit position.

I did this using storing the position of the hit in a variable. I moved the effector using the stored position with a move towards but although it moves towards the correct position, her hands moves high above her head and won't change.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Mecanim IK and layers
« Reply #8 on: November 05, 2013, 10:31:59 AM »
Hi,

 Yes, of course, there is not restrictions as to where an IK position can be really.

I think you are having a problem of IK enabling, mayb you don't enable the right limb? can you double check with the demo provided on the wiki?

bye,

 Jean

Sheridah

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Mecanim IK and layers (solved)
« Reply #9 on: November 10, 2013, 02:58:49 AM »
I managed to fix it by changing the offset of the IK. Thank you for your help! Everything works like a charm now ;)

Sheridah

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Mecanim IK and layers (solved)
« Reply #10 on: November 12, 2013, 12:56:58 PM »
Changing the offset wasn't the solution after all. It turned out that the scale of the parentobject of my character was more than 1. Unity assumed that the same would be true for my charactermodel. By changing it back to 1 everything now works perfectly.