- Home /
respawn player problems
Hello, I'm having trouble with my player respawn .. the model arises when the player is changing position "looking up" is not on the same position before!
static var lives: int = 3;
var player: GameObject;
function Update () { }
Respawn function () { WaitForSeconds yield (1); Instantiate (player, Vector3 (-0.3,0.4, -4.7), transform.rotation);
}
this is the script for the player to respawn when he dies and is born he is "looking" up and completely change the controls! help me please .. how do I get the player standing on the same position? There is another reference to respawn I test?
Answer by kievar1983 · Jan 04, 2012 at 03:42 AM
if you are loading from a prefab, use the prefab's transformation and rotation, if not store the player's orientation in a temp object right before he dies and orient the new player looking and facing the same way the temp object was.
hello, well my player starts with the rotation axis x: 270, Y: 180 and Z: 0, prefab it begins, so that when I use this script it resets all the rotation and the player is looking up .. there is something for him to change the rotation axes when they respawn? and thank you for the feedback
Answer by pravinyadav · Jan 04, 2012 at 05:13 AM
Pls recheck where u r attaching this script. transform.rotation might be referring to that gameobject. As kievar pointed , always use prefab for instantiation. Have a look at http://unity3d.com/support/documentation/Manual/Prefabs.html
hello, well my player starts with the rotation axis x: 270, Y: 180 and Z: 0, prefab it begins, so that when I use this script it resets all the rotation and the player is looking up .. there is something for him to change the rotation axes when they respawn? and thank you for the feedback
Answer by mdinizzz · Jan 10, 2012 at 08:41 PM
done .. placed inside the empty game object with the coordinates 0 and it's all ok ..
Answer by mdinizzz · Jan 10, 2012 at 08:41 PM
done .. placed inside the empty game object with the coordinates 0 and it's all ok ..
Answer by mdinizzz · Jan 10, 2012 at 08:40 PM
done .. placed inside the empty game object with the coordinates 0 and it's all ok ..
Your answer
![](https://koobas.hobune.stream/wayback/20220613062637im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
(Solved!) OnEnable spams error messages 1 Answer
Respawn System not Moving Character 0 Answers
Why can't I make my character die? 3 Answers
How to get your player to respawn when in void (C#) 2 Answers