|
Post by koykot123 on Jul 1, 2022 23:16:09 GMT
Hi guys, i am trying to make a shapeshifting system for months but i could not achieve it. For example, when i turn into werewolf my system works well but when i return back to my main character, my camera does not follow my character at all, and also after first transformation, input of the second character does not work well. I do not know how to find any solution for my problem. I created threads in many forum web sites but no one helped me :( Please help me.
My simple script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class shapeshift : MonoBehaviour
{
public GameObject Human;
public GameObject Wolf;
private int ShiftNum;
void Start ()
{
Human.SetActive (true);
Wolf.SetActive (false);
ShiftNum = 1;
}
void Update ()
{
if (Input.GetKeyDown (KeyCode.Z))
if (ShiftNum == 1)
{
Human.SetActive (false);
Wolf.SetActive (true);
ShiftNum = 2;
Wolf.transform.position = Human.transform.position;
Wolf.transform.rotation = Human.transform.rotation;
}
else if (Input.GetKeyDown (KeyCode.Z))
if (ShiftNum == 2)
{
Human.SetActive (true);
Wolf.SetActive (false);
ShiftNum = 1;
Human.transform.position = Wolf.transform.position;
Human.transform.rotation = Wolf.transform.rotation;
}
}
}
|
|
|
Post by jlock10 on Oct 31, 2023 15:04:23 GMT
Try Scrapping the Code (Not actually but don't use it, with this method).
1st set your main character up how you want its (cameras, weapons etc) , Then Set your werewolf up in a another controller with it's respective settings.
Use Invectors scripts to do. Try a vTrigger event or something like and In the "Events" Set Active True the Werewolf Controller when you trigger the event and setactive false the main character.
It should be easy to switch back and fourth.
|
|