Posted June 13, 20205 yr Since 1.15 introduced a lot of significant changes as opposed to 1.12, I cannot figure out how to RayTrace an entity from a range further than what pointedEntity allows (~4 blocks) I am able to raytrace blocks from an increased range using BlockRayTraceResult, but I am unsure how to apply this to entities. I want to be able to target an entity from a range of about 50 blocks. Please let me know where to start. Thank You.
June 13, 20205 yr Howdy Have you looked at ProjectileHelper::rayTraceEntities? You should be able to adapt the code in there to do what you want. 50 blocks is a very long way,though. It might be more efficient to use a different algorithm which filters entities manually, i.e. for each entity in world { vec3d entityPosition = entity - origin check if position is in the correct octant (x +ve or -ve, y +ve or -ve, z + or -ve etc) if so { vec3d distanceFromEntityToRay = cross product (position, ray) / norm (ray) if distanceFromEntityToRay < 5 then include in detailed raytrace otherwise exclude } } you'll need to know a bit of vector math to do that... -TGG
June 15, 20205 yr Author hmm the code i used in my old mod came from the source code of a different mod, but im not sure if it can be adapted to 1.15, i believe it involved vector math aswell might have to give it a go Thank you for the pointers though! Edit: Found some code from another mod that I believe I can adapt to my specific use case Edited June 15, 20205 yr by -TheLittleGuy
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.