Hi, I’m making a simple FPS, just to try it, and it is going pretty good so far. I have created a gun model in blender, and imported it into unity and used it as a rocket launcher (instead of the one in the FPS Tutorial) but when I used the code given, It fired sideways out of the gun. anyway i fixed this problem but it presented me with another, when i fire the rocket sometimes it will collide with the walls, and other times it will simply fly through them! I also imported one of my walls from blender, and it collides with this one the least, the rest of the walls are cubes from Unity. Why does it do this, what should I do?
thanks in advance!
This problem usually occurs if the projectile is moving too fast for the physics to keep up with. Essentially, the object moves from one side of a collider to the other on a single frame update, so the physics can’t tell if it collided or not. You will tend to get this problem especially with mesh colliders, which would probably explain why your Blender models perform worse than the cubes. You can improve the situation by setting your Time.fixedDeltaTime value to reduce the interval between physics updates. However, you might have to resort to using a raycast to look ahead to the approaching target object. There is a script to do this here on the Unify wiki.
thanks so much, this problem has been bugging me for ever, and no matter how much changing i did nothing seemed to work, this saved me hours of frustration!
I’m having this same problem with fast moving projectiles. I tried using that script andeeee posted, but it doesn’t seem to do anything. In the usage it says:
But if I do that, it’s like the script isn’t even there. However if I set the LayerMask to the layer the projectile is on (default), the collisions seem to work but the projectile behaves oddly after colliding. It just flies around randomly for a while and stops.
Help?
Ah, never mind. The projectiles just needed to be on a different layer than everything else, and the LayerMask set to default.