-
-
Notifications
You must be signed in to change notification settings - Fork 394
Facing Relative Vector Offset #7925
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
base: dev/feature
Are you sure you want to change the base?
Facing Relative Vector Offset #7925
Conversation
Vector o = new Vector(0, 0, 0); | ||
o.add(left.multiply(offset.getX())); | ||
o.add(up.multiply(offset.getY())); | ||
o.add(forward.multiply(offset.getZ())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not initialize the XYZ values directly?
*/ | ||
private static Location getFacingRelativeOffset(Location loc, Vector offset) { | ||
Vector forward = loc.getDirection(); | ||
Vector up = new Vector(0, 1, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't actually the local up direction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to replace this whole method with Quaternionf.rotationZYX and use that to transform the vectors
Problem
There isn't a shorthand way to offset a location while considering rotation.
Solution
Adds a new pattern to the existing offset syntax. This can be compared to ^^^ in vanilla commands (like
/summon tnt ^1 ^2 ^3
)before:
with this PR:
and this isn't even showing the work you would've done to achieve an X or Y offset at the same time
I was going to update the syntax description but not sure how I should explain this
Testing Completed
Only manual testing was done, comparing the syntax to the vanilla Minecraft command
Completes: none
Related: none