- Home /
This question was
closed Apr 27, 2013 at 05:22 PM by
Fattie for the following reason:
The question is answered, right answer was accepted
Wrong rotation while moving
Have a simple script that moves an object and rotating it, i want that an object will move while rotating around its axix, but it rotes its Vector perhaps, and works wrong, Thank for any help.
using UnityEngine; using System.Collections;
public class Meteor : MonoBehaviour {
public float speed = 10f;
void OnCollisionEnter(Collision collision)
{
Destroy(gameObject);
}
// Update is called once per frame
void Update ()
{
transform.Translate(Vector3.down * Time.deltaTime * speed);
transform.Rotate(2, 0, 2);
}
}
Comment
Best Answer
Answer by $$anonymous$$ · Apr 27, 2013 at 05:22 PM
Fixed by using this moving:
Vector3 NewPos; NewPos = transform.position;
NewPos.y = NewPos.y - speed;
transform.position = NewPos;
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
Rotation for 180 degrees of character 1 Answer
Rotating a model with increments 1 Answer