-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sensor .islookingAt table not returning values when looking at entities. #30
Comments
It's not implemented. Sounds like good idea, may implement later. But we decided to freeze 1.6.4 (no new features, bugfixes only), so this one may be done after 1.7 port. |
Is that hard to implement? I have a lot of mods that will not be upgraded to 1.6.4 by a good timme. |
I am not sure, but can I use the yaw, yawHeah, and pitch to trace the vision target? |
If yes, how can I do that? ( Sorry, no edit button on Android ) |
Create a 'ray' (vector) from the head position in the direction of yaw and pitch. Create an Axis Aligned bounding box in Lua, by taking the position of the entity, and subtracting/adding half the dimension in each direction to get two vectors, minXYZ and maxXYZ. From here you want to check for a Ray-Box intersection. This all depends on how good your understanding of 3D constructs and trigonometry is. Here is a paper on Ray Box intersection. Pseudo-Code is provided on this article; if your programming ability and understanding are strong enough, you should be able to implement this in Lua without too much trouble. Note this takes no consideration of distance or occlusion (An object in front of the entity blocking the view). You'll have to decide how to handle that yourself. |
So, I transform whatever angle information it is on degrees, then use tangent that for every x position, for example, the z must be x times the tangent of the angle between the distance ray and the x distance, then if isLookingAtBlock == false, the nearest mob that matches the x and z conditions is choosen as the target. |
I think that would work yes :) |
I'm guessing you worked this out, @TorakWolf |
I am not sure if this is propositional, but without that function I can't make one aim assistant program, or one "spider sense" warning program that alerts you about unwanted scrutinize of hostile hobs.
When the player/mob is looking at one block, all is ok...
The text was updated successfully, but these errors were encountered: