-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
drawLine uses <RectangleRenderer> instead of <LineRenderer> #3117
Comments
Thanks @robknopf this definitely looks wrong... Can you send me an example screenshot of where it's going wrong for you and what you expected |
I threw together a codepen to demonstrate it here. If this doesn't suffice, let me know! |
@robknopf Okay I think I know what's up. I'm going to be adding an explainer and some diagrams to the docs to help prevent this issue in the future. I'm labelling this as a docs+bug until I resolve that. The reason I think this is confusing is actors have a center anchor by default
Setting the anchor to Here is the code, I used to tweak it to be what you wanted where the line goes from the center of the box to the edge. Line relative to the center so starting at 0, and out to the edge at 25. const line = new ex.Actor({
pos: vec(0, 0)
});
line.graphics.anchor = vec(0, 0);
line.graphics.use(
new ex.Line({
start: vec(0, 0),
end: vec(25, 25),
color: ex.Color.Red
})
); |
Wow.. impressively detailed response. The line isn't a child (in this case), so placing that actor it in the same position as the square and not changing the anchor (for either of them) feels like it should behave like I expected: A line from (0,0) to (25, 25) draws from the anchor (center) to the corner. There separate coordinate spaces between the actor and the associated graphic is a little confusing, but perhaps some documentation around the relationship will help. Regardless, now I know and knowing is half the battle (so I hear). Thank you! I'll leave this open if you want any additional followup discussions, but I consider it closed. |
Thanks for digging into this with me! It does feel confusing for lines 100% I'll be chewing on this for a while. Totally missed that line wasn't a child 🤦 but luckily doesn't change the math whew! |
This issue hasn't had any recent activity lately and is being marked as stale automatically. |
Drawing a line from a starting position other than (0,0) renders an incorrect line. Looks like drawLine is using RectangleRenderer instead of LineRenderer:
Excalibur/src/engine/Graphics/Context/ExcaliburGraphicsContextWebGL.ts
Lines 524 to 526 in 30bd1c5
The text was updated successfully, but these errors were encountered: