Peeta
August 15, 2014, 8:14pm
1
I wanted to make sure that my item would make a 180 ° turn. I tried something like this but did not come back. You know you help me?
#pragma strict
var incr : float = 0.1;
var angle : float = 0.0;
function Start () {
}
function FixedUpdate () {
while(angle < 180 * 6.28 / 360 ){
transform.position = Vector3(30*Mathf.Sin(angle)*Time.deltaTime, 30*Mathf.Cos(angle)*Time.deltaTime,0);
angle+=0.1;
}
}
roger0
August 15, 2014, 10:00pm
2
Your using transform.position instead of transform.rotation. I don’t see how the rotation would be effected at all.
Peeta
August 15, 2014, 10:21pm
3
The object is not to turn on itself but must simulate a circumference just that I want to simulate a half circumference
roger0
August 15, 2014, 10:38pm
4
So the object is suppose to turn around like a car would, not turn in place? For that you would use something like transform.transformDirection. I have some code berried somewhere I can find if that’s the case.