- Home /
Movement of an prefab without rigidbody?
public float velocidad = 1f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
rigidbody2D.velocity = new Vector2(velocidad, rigidbody2D.velocity.y);
}
}
is there any way to do a similar code for move, but without the rigidbody? becouse that slows a lot the game
Couldn't you simply change the transform of that object?
Answer by salvador007 · Jan 09, 2015 at 06:28 AM
Adding rigidbody component to a gameObject will help it to behave under Unity's Physics engine like it will be under influence of gravity ,you can add force ,velocity etc.
But without rigidbody you can't implement physics on that gameobject , but still you can move it from one position to other by changing its position by accessing its transform component if moving prefab is the only purpose here.
Hope I made it clear.
Your answer
Follow this Question
Related Questions
Move 2D ground up and down 1 Answer
How can I make a non-player character (rigidbody) move when they touch the ground? 1 Answer
Emerging Gap when moving my "Snake" 1 Answer
Megaman Movement 0 Answers