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

How can set predefine path ? #1241

Closed
yashk2023 opened this issue Sep 6, 2023 · 1 comment
Closed

How can set predefine path ? #1241

yashk2023 opened this issue Sep 6, 2023 · 1 comment

Comments

@yashk2023
Copy link

yashk2023 commented Sep 6, 2023

I'm creating a game.
where functionality is user select a top arrow and drop the ball, and I make an API call to decide the bottom slot.

I need guidance on creating dynamic paths from the selected arrow to the determined slot. How can I achieve this functionality efficiently within Matter.js, considering possible obstacles? Any code examples or tips would be greatly appreciated.

@ggorlen
Copy link

ggorlen commented Oct 3, 2023

Related:

If you can provide more details or a minimal example of your game, it'd be easier to write a concrete answer. If there are only a small number of possible paths, you could precompute/simulate a bunch of paths in advance, categorize them according to slots, then pick one corresponding to the slot you want and run the animation. Another approach, depending on your use case, may be to add invisible walls or apply forces to steer the ball to the intended destination.

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

No branches or pull requests

2 participants