- Home /
Randomly keeping paintball intact on collision
For my paintball game, I want random paintballs to bounce rather than splatter like in a real match. Is there a way I can make some of the paintballs shot bounce and remain intact while most other smash (Say, a 1 in 30 chance). I'm thinking a script would work but I have very little experience.
Also, I'm using an object, not raycasting
Answer by Nemrav · Jan 29, 2015 at 12:13 AM
public float num;
void update(){
num = Random.Range(1,30);
print (num);
if(num == 1){your bounce stuff} else {smash stuff}
}
For the bounce stuff, you simply do nothing and maybe make the bounces bigger using physics materials, and for your smash you do an object swap (there are plenty of tutorials, most of them replacing a player with a ragdoll)
Sweet, thanks. I actually managed to get it working. Thanks again!
Your answer
Follow this Question
Related Questions
Edit - Code isolation using random ID numbers C# 1 Answer
Destroy Bullet on Random Collision 0 Answers
Creating a Asteroid health script 5 Answers
Destroy bullet on random collision 2 Answers