hi to all the nice peopple
i need help to make a compass using quaternion and rotate thee compass only on the y axis.
tks
hi to all the nice peopple
i need help to make a compass using quaternion and rotate thee compass only on the y axis.
tks
Create an empty gameObject and put it north of your map then create a compass script.
Something like this should get you going :
public Transform north;
public Transform compassPointer;
void Update () {
Vector3 targetPos = north.position - compassPointer.position;
targetPos.y = 0;
Quaternion targetRot = Quaternion.LookRotation(targetPos);
compassPointer.rotation = Quaternion.Slerp(compassPointer.rotation,targetRot,Time.deltaTime * 2.0f);
}
ok tks, i will test it and then i´ll tell you how it worked.
sorry to answer late