hello
I started working with the FPS tutorial. I am almost at the end of the second part, but there is a problem
I have added the machine gun and rocket launcher (having in mind that I didn’t use the models in the project, I used my own) so everything goes well with the machine gun so when the machine gun shoots the objects they do disapear or destroyed (the ones that supposed to) but the rocket launcher doesn’t have any effect on the same objects. here is the link that you can see the game and play it online
www.raminsh.com/FPSTest.html
can somebody tell me what is up here?
Can you post the script you are using for the rocket? (I’m assuming that is the script that should detect when an object has been hit and destroy it.)
hello
thanks for the reply. I have attached the script to this post
funny thing is I made this script right from the tutorial and I double checked and it matches. so is the script in tutorial missing something.
on the other hand I was wondering if you can help me with this other problem as well. the issue is that no matter what number i put for hit point on the object they still distruct with one hit of the machine gun.
229541–8242–$rocketlauncher_166.js (887 Bytes)
The script you have attached is actually the one that launches the rocket. The script I really need to see is the one which should be applying the rocket damage.
hello
thanks for the reply again
I can see 2 other scripts that are similar to what you are asking for. one is the rocket script and the other one is the damage receiver. I am gonna attach both of them to this email. and as I said in previous post, besides the rocket launcher problem, the other problem is whatever had damage receiver attached, they get destroyed after getting hit by the machinegun shot eventhough when I set the hitpoints high.
thanks again
230151–8258–$damagereceiverm_273.js (1.42 KB)
230151–8259–$rocket_106.js (953 Bytes)
In the rocket’s OnCollisionEnter script, you need to call ApplyDamage on the object it collides with:-
collision.gameObject.SendMessage("ApplyDamage", 5.0);
(The damage doesn’t need to be 5.0, of course
)
thanks very much
problem solved