- Home /
Bullet Behavior with bounce without loosing speed when bounce with another objects.
I created a game with 4 objects, and i want to add bullet behavior to them. They already have an AddForce but when they collide, especially when they front colide (180°), they lose speed, and i don't want that. I want to create 4 objects with constant speed even when bounce with other objects or walls. The objects must never slow down.
#pragma strict
function Start () {
rigidbody2D.AddForce (new Vector2 (Random.Range(-100, 100), Random.Range(-100, 100)));
}
Answer by robertbu · Nov 04, 2014 at 04:57 PM
You will need to put a script on the bullet itself. In FixedUpdate(), add the line:
rigidbody2D.velocity = rigidbody2D.velocity.normalized * someSpeed;
...where 'someSpeed' is the speed you want for your bullet.
Your answer
Follow this Question
Related Questions
Bounce into the air 1 Answer
bullet problems 1 Answer
AddForce is not working 1 Answer
Basic 2d movement problem: glitching in terrain 0 Answers
How to make automatically moving sprite not passing through another sprite? 1 Answer