Re: Making Magmaul-derived laser sight stop upon targetting MOID
You'd have to cast a ray to determine the endpoint, but the rest of that code should be functional. Basically you'd need to replace
Code:
if SceneMan:GetTerrMatter(self.guideParPos.X,self.guideParPos.Y) == 0 then
in both if blocks with a check against the resultant particle from an MORay cast. You should only need to do the raycast once, though you might want to repeat it depending on projectile speed.
Specifically, you need an
obstacle ray.
Basically, if you're not 100% on how that code is working, it's generating the particles on a per-frame basis based on the particle's RotAngle, and it's avoiding terrain with the GetTerrMatter check (0 is Air). Replace that check with the equivalent ObstacleRay end value and you won't be able to pass through MOs or terrain
if that didn't make any sense I could theoretically work up better code