- Home /
The question is answered, right answer was accepted
Can a Gameobject that is controlled by Animator be dragged by a non animator controlled object
I am trying to make a mounting system with the new Mecanim system. I am using a Player controlled by Mecanim Animator State Machine. The player moves fine with out the mount. The mount is a horse that is set active and at the proper position under the player, who is changed to a riding position.
The mount is controlled by a legacy controller. The mount can try to move and the animations on it work but it is stuck and jittering around the player.
I tried to have the mount carry/pull the player around with the following code:
PHP Code: [PHP]// handling mount section
else if (currentBaseState.nameHash == mountState)
{
col.height = 1.01f; // me
mount.gameObject.SetActive(true);
mount.t.eulerAngles = player.transform.eulerAngles;
//onMount = true;
//player.SetActive(false);
mount.Initialize();
mount.t.position = player.transform.position + Vector3.down;
player.transform.position = mount.transform.position; // I expect the mount to drag (carry) the player around
print("I'm here isMounted");
}
else if (currentBaseState.nameHash != mountState)
{
mount.gameObject.SetActive(false);
}
[/PHP]
Can anyone give me some advice. Thanks
https://docs.google.com/open?id=0B4e...VM2czg2LW9vVUU
https://docs.google.com/open?id=0B4e...EI2cWItUWNSVFU
https://docs.google.com/open?id=0B4e...kV6ZmlKUU5ULW8
Robert
Answer by meat5000 · Jun 24, 2014 at 01:34 PM
Parent the player to the mount. The player will function as normal within its own animations and move with the mount.