Hello.
I am a beginner and I am testing for FPS with Oculus using a Gun and a raycast with impacts.
But I have a problem with my impacts moving with the movements of my gun.
I attached a gun to one of the hands, I use a raycast for shooting and collisions. All of them work except that the impacts, instead of remaining fixed at their point of impact, follow the movement of my gun!
It’s like the raycast stayed on and the impact continued to follow it!
Anyone have any idea of the problem?
Thanks for your help.
My script :
ray.origin = raycastOrigin.position;
ray.direction = raycastOrigin.forward;
var tracer = Instantiate(tracerEffect, ray.origin, Quaternion.identity);
tracer.AddPosition(ray.origin);
if(Physics.Raycast(ray, out hitInfo)){
tracer.transform.position = hitInfo.point;
if(hitInfo.collider.gameObject.tag == “Levier collider”)
{
impactMetal.transform.position = hitInfo.point;
impactMetal.transform.forward = hitInfo.normal;
impactMetal.Emit(1);
} else {
impactOther.transform.position = hitInfo.point;
impactOther.transform.forward = hitInfo.normal;
impactOther.Emit(1);
}
}
I found the problem.
You had to select “world” in the particle settings.