I have a problem with my Raycast/BulletHole in my FireRaycast() Function.
If I shoot, it doesnt spawn my Hitsparks and BulletHoles on the hitted Raycast Position (Position where the bullet impacts). If they spawn, they spawn in the space in front of my weapon. (see pic) In this case, the console debug log tells me that I hit the FPSController...?!?
Do anybody have a solution for that?
I want that it always hits walls or the bottom and so on..
function FireRaycast() {
var hit : RaycastHit;
if (Physics.Raycast(shootPoint.position, shootPoint.transform.forward, hit, range)) {
Debug.Log(hit.transform.name + " FOUND!");
var hitParticleEffect = Instantiate(hitParticles, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal));
var bulletHole : GameObject= Instantiate(bulletImpact, hit.point, Quaternion.FromToRotation(Vector3.forward, hit.normal));
Destroy(hitParticleEffect, 1f);
Destroy(bulletHole, 2f);
}
}
Thank u guys!