Author Topic: Firing a projectile at the end of a raycast  (Read 1442 times)


Get the final position from the end of the raycast, then spawn a projectile

Ok I've never worked with ray casts before,
How do I fire a ray cast?
How do I get what it hit?
How do I get the position of what it hit?

From Spaceguy's Support_RaycastingWeapons

%ray = ContainerRayCast(%start, %end, %targets, %obj);
%start is where the ray begins
%end is vectorAdd(%start,vectorScale(%shotVec,%range)); where %start = %obj.getMuzzlePoint(0); %aimVec = %obj.getMuzzleVector(0); and %range is quite obvious

%targets is the list of typemasks the ray will react to
%obj is probably the object the raycast was fired from