- Home /
Get only -180 to 180 value
hello!
i'm looking for a way to get back only the value from -180 to 180 on my rotate object, because up -180 it will go to -181 and so on...
thank's you in advance
Comment
I think you're looking for the $$anonymous$$athf.Clamp function, but if you post your code, I can better help you.
is this, works well until player angle will go out of -180
_temporanyValue[id] = _playerAngle[id];
if(_temporanyValue[id] >= 0)
{
_target[id] = _temporanyValue[id] / 360;
float FixedY = $$anonymous$$athf.Lerp(12f,15f,_target[id]);
Vector3 fixedPos = new Vector3(_iconObject[id].transform.position.x,FixedY,_iconObject[id].transform.position.z);
_iconObject[id].transform.position = fixedPos;
}
else
{
_target[id] = (360 + _temporanyValue[id]) / 360;
float FixedY = $$anonymous$$athf.Lerp(15f,12f,_target[id]);
Vector3 fixedPos = new Vector3(_iconObject[id].transform.position.x,FixedY,_iconObject[id].transform.position.z);
_iconObject[id].transform.position = fixedPos;
}
That code is very cryptic. Can you better explain what exactly it is your trying to achieve? $$anonymous$$aybe provide an image or a video?
Your answer
Follow this Question
Related Questions
problem with object rotation 1 Answer
Player making a 360° looping, camera not following 0 Answers
Script for a GUI button to change an object's rotation? 1 Answer
Weird Output from AngleAxis 0 Answers
How to "clamp" a y rotation in unity? 0 Answers