One fairly easy way to do this is to find a vector that is always normal to the ship wall. For instance, you can place an E2 gate on the wall and use its entity():up() vector. Then you take the vector from the turret to the target and project it onto that normal vector. If the projection has a positive length, the target is inside that hemisphere.
Code:Normal=entity():up()#Or some other one you find. Projlength=Totarget:dot(Normal) #The vector projection is Projlength*Normal, but we only really need the length if(Projlength>0){Target normally}else{Face forward}


LinkBack URL
About LinkBacks






Reply With Quote



Bookmarks