Category | Scripting |
Created | 17.05.2015 15:03 |
Bilbo Beutlin (BBeutlin) | 17.05.2015 15:04 |
---|---|
How exactly does the raycast work? Does the raycast vector describe a virtual box? Or is it a cylinder? Or a hemisphere? And has the method changed from FS13 to 15? I made a mod in FS13 where the raycast worked fine. However now in FS15 I had to adapt several values, but still not works exactly as in FS13. |
Fabian Sch (Unknown) | 17.05.2015 17:23 |
---|---|
Hi, the raycast "looks" from a point in a direction (like a laser pointer). this example looks 20m downwards: raycastAll(x, y, z, 0, -1, 0, "findMyNodeRaycastCallback", 20, self) if the raycast hits something, then self:findMyNodeRaycastCallback is called. it should return false to stop searching: function ClassOfSelf:findMyNodeRaycastCallback(transformId, x, y, z, distance) if (condition) then self.raycastTriggerFound = true return false end return true end set self.raycastTriggerFound=false before calling raycastAll(), then you know afterwards if you found what you looked for. Thought it works exactly as in FS13, but hope this helps. |
Bilbo Beutlin (BBeutlin) | 17.05.2015 19:53 |
---|---|
I know - the RC callback handling is no problem. In my mentioned FS13 mod I had two RC nodes: rc1 front-right-bottom, rc2 back-left-top. .. local x1,y1,z1 = getWorldTranslation(self.rc1); local x2,y2,z2 = getWorldTranslation(self.rc2); local dx,dy,dz = x2-x1, y2-y1, z2-z1; local vLen = Utils.vector3Length(dx,dy,dz); .. raycastAll(x1, y1, z1, dx, dy, dz, "rcCallback", vLen, self, raycastMask, false); .. That worked fine, indeed I got the hits included in this 'virtual box'. However no longer works satisfying in FS15. |
Fabian Sch (Unknown) | 17.05.2015 22:49 |
---|---|
I think there is no box, just a beam. You might want to spawn a trigger shape to get callbacks for the whole volume you defined. |
Note: Log in to post. Create a new account here.