- Home /
how to safe player rotation
-ask- how to save the data, for example, my player hit a cube with xyz rotation, i want to save it into a variable. this is for position data.Ycordinat=transform.position.y;
You want to save the collision point when a collision happens?
no, gameobject have position, rotation and scale, each have x y z. i want save the x y z rotation to other variable, so i can use it to other. if position is transform.position.y.
safe != save. Anyway, I think @$$anonymous$$ander got what you need.
Answer by Mander · Aug 21, 2012 at 05:16 PM
var saveRotation : Quaternion;
function OnEnterTrigger(hit : collider){
saveRotation = gameObject.transform.localRotation;
}
i have four variables Xposition, Yposition, Zposition, XYZrotation,(in other .js) i want put this when my player hit a cube (like a checkpoint)
data.XYZrotation = gameObject.transform.localRotation; player.transform.position = Vector3(data.Xposition,data.Yposition,data.Zposition); player.transform.rotation = Vector3(data.XYZrotation); either this player.transform.position =
player.transform.rotation =Vector3(data.Xposition,data.Yposition,data.Zposition,data.XYZrotation);
all off give me an error? any solution?
ur data script variables should be declared as static in ur data script
static var Xposition : float; static var Yposition : float; static var Zposition : float; static var XYZrotation : Quaternion;
then in the other script
data.Xposition = player.transform.localposition.x; data.Yposition = player.transform.localposition.y; data.Zposition = player.transform.localposition.z; data.XYZrotation = player.transform.localrotation;
or u could just declare 1 xyz variable at ur data script
static var XYZposition : transform;
then in the other script
data.XYZposition = player.transform;
Your answer

Follow this Question
Related Questions
How to make a player rotate in a direction with a slope of the ground. 0 Answers
freeze rigidbody of my player 1 Answer
Rotating the player animation also rotates the player 2 Answers
Make player face different enemies with the same tag 0 Answers
How to make a flashlight (childed to the player) rotate with the player? 1 Answer