Skip to main content

Timeline for My bullets won't bounce in Unity?

Current License: CC BY-SA 4.0

7 events
when toggle format what by license comment
Jul 21, 2020 at 16:04 comment added Kevin @kayrayorulmaz Please post your updated code in your question.
Jul 21, 2020 at 14:02 comment added kayra yorulmaz I decreased the mass to 1e-7 and increased bulletSpeed by 1000, and even then the speed didn't change.
Jul 21, 2020 at 13:50 comment added Philipp @kayrayorulmaz Did you try lowering the mass and friction in the rigidbody of your bullets?
Jul 21, 2020 at 13:34 comment added kayra yorulmaz I moved all of the code (which is 'lastVelocity = bulletRB.velocity;' and 'bulletRB.AddForce(transform.forward * bulletSpeed);' ) to the Start() void so that the speed wouldn't be affected every frame. However, now the bullets are moving too slowly no matter how much I change bulletSpeed.
Jul 21, 2020 at 13:26 comment added Philipp @kayrayorulmaz Are you still having any code in Update or FixedUpdate? For proper ballistic physics, you shouldn't. The AddForce should happen once when the bullet is instantiated. And then you do not touch the velocity or the position while the bullet is flying.
Jul 21, 2020 at 13:21 comment added kayra yorulmaz Changing transform.position did fix the problem of bullets being stuck to the walls, but for some reason now the bullets bounce back onto the same wall in an arc and the bullets accelerate instead of immediately flying out.
Jul 21, 2020 at 12:57 history answered Philipp CC BY-SA 4.0