|
Post by akinesis on Oct 1, 2019 12:17:50 GMT
Hello,
I'm new to Invector third person amazing camera and i'm facing a litle problem.
I'm trying to dynamicly swap characters wich have differet model, animator and camera (for test purpose one have basic locomotion, one is melee and one shooter melee).
I've tryed playing with the game controller spawn functionality but not with great result. Best i can do is trigger the death of the first caracter, swap character prefab and when respawn is trigger, it's the new character wich is spawned. But not with its apropriate camera !
So i'm unsure what i shoud do or if i'm following the good procedure to do what i want to do.
If anyone has insight i'll be extremly gratefull.
Thanks.
|
|
|
Post by Invector on Oct 1, 2019 12:42:32 GMT
You can use a single camera, and call the method SetTarget(transform) to switch between controllers
|
|
|
Post by akinesis on Oct 1, 2019 13:26:34 GMT
Hello, thanks for your quick response.
Hower i still have a problem. Beacause if i whant to add a new target to the camera i have to Instantiate one on my player prefab (character with Third person controller).
Hower trying to instantiate with a simple code such as :
public void SwapPlayer(string characterClass) {
Transform spawnPoint = player.transform;
Destroy(player);
player = Instantiate(druidPlayer, spawnPoint) as GameObject;
} Result in the destruction of the actual prefab but no nex prefabis spawend at its place.
If i fo it manual in the scene view at runtime, it's work perfectly.
Do you have an idea of what i'm missing ?
|
|
|
Post by Invector on Oct 1, 2019 14:40:37 GMT
make sure to uncheck the option "Use Instance" in both controllers inspector > grounded tab
|
|
|
Post by akinesis on Oct 1, 2019 16:59:10 GMT
Thank you !
It's working just fine now.
I also had a probleme due to my method of Instanciation and i had to di tis
Destroy(player);
Instantiate(druidPlayer, player.transform.position, player.transform.rotation); But otherwise everything is OK.
|
|