|
Hello. I'm trying implement a raycast shooting system for my FPS game. the problem is, everytime I try to instantiate a spark effect at the point of impact, it returns a location of (0,0,0) and creates the spark at that location no matter where I shoot it. Here is the relevent shooting code. Also, I am using Unity 3.5 (this may be the issue). Please note that the rocket contains no problems, only the Gun type. The object this is attached to is a child of the camera. Sickly code: /////////////////////////////////// full code:
(comments are locked)
|
|
You never declare hit inside your Raycast, that should be the issue. Sorry for the off topic, Unity 3.5 is released? (oh happy day!) :) I think you're pretty much the best ever ;) It works! //////// for others having this problem, change it to something like var hit: RaycastHit; if (Physics.Raycast(transform,rotation,hit)));
Dec 29 '11 at 04:55 PM
TehWut
(comments are locked)
|
