Can’t figure it out. I’ve been through dozens of discussions which you’d think would answer it but none of the answers seem to work.
For some reason it was more complicated to parent the player prefab to a vehicle using gameobjects as mountpoints so I just use myTransform.Translate(0,1.5f, 2) to move the character up and over.
Currently the trigger event fires off a function called Mount() looks like:
public void Mount() {
_horse = transform.Find("Horse");
CharacterController playerMove = _controller; //previously cached it in script
CharacterController horseMove = GetComponent<CharacterController>(); //how I get horse controller?
_myTransform.parent = _horse;
playerMove.active = false; //turns controller off to switch to next.
horseMove.active = true; //turn horse controller on
_myTransform.Translate(0,1.5f,3);
_myTransform.transform.localRotation = Quaternion.identity;
//also tried stuff like this
// _horse.GetComponent<CharacterController>().active = true;
}
Basically when I run into anything tagged “horse” it triggers that function which turns me to face forward and moves the char up and over while disabling the controller, but I can’t figure out how to access the horse controller to turn it on. I tried a tank controller script, several car controllers and just cannot figure it out. Anything would work, even a FPS controller to drive the horse so I can turn with the mouse and use WASD and maybe even jump…