Skip to content
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

[WIP] Start to work on raycast & line #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kefniark
Copy link
Owner

@kefniark kefniark commented Nov 24, 2019

Description

Work on selection and colision

  • Raycast
  • Line
  • Rect
  • Circle

Issue

Screenshot

raycast

@lgtm-com
Copy link

lgtm-com bot commented Nov 24, 2019

This pull request introduces 2 alerts and fixes 1 when merging a5352a9 into c343554 - view on LGTM.com

new alerts:

  • 2 for Call to eval-like DOM function

fixed alerts:

  • 1 for Call to eval-like DOM function

const diffX = h * 0.5 - (source.x - Math.round(source.x))
for (let i = 0; i < max; i++) {
const x = diffX + i * h
const y = x * Math.tan((angle * Math.PI) / 180)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this Math.tan value is always the same, can be put outside of the for loop

const diffY = v * 0.5 - (source.y - Math.round(source.y))
for (let j = 0; j < max; j++) {
const y = diffY + j * v
const x = y / Math.tan((angle * Math.PI) / 180)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

@kefniark
Copy link
Owner Author

Started to move the sample to pixi, looks the same so far, except I switched to pixel perfect rendering in 192x192

raycastPixi

@kefniark
Copy link
Owner Author

kefniark commented Nov 25, 2019

Interesting ... increasing the amount of raycast every frame, I noticed that few lines manage to go through object 🤔 (following gif with 192 raycast)
seems to be related with colision with corners

raycastPixi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant