+ 2
Polygon Collision
Does anyone know how to handle triangle -> circle collisions? I read on Stackoverflow it is a similar method to circle -> circle, but here it won't work. https://code.sololearn.com/WKipUEZULwLG/?ref=app
7 Antworten
+ 4
You could use a npm module.
https://www.npmjs.com/package/triangle-circle-collision
Then use browserify to bundle it into a js file.
+ 4
Hi Farry , I've decided to try again at games. I've messed up already. Every 1 second it is meant to spawn an ellipse at a random location. All it does is teleport. How can I make it spawn in a random place, and stay there. I would use variables, although they only work once. Can you help?
edit: I am working on it now, I think I have an idea. I will get back to if it doesn't work
edit: Just as I thought, not working
https://code.sololearn.com/WeLuUVw4NvuS/?ref=app
+ 2
Farry Good, although I meant like this code
https://code.sololearn.com/WV0K3dX75RYb/?ref=app
Where it spawns 1 sprite/ball at a random location and stays there
+ 1
convex polygon collisions can be handled using SAT (separating axis theorem) which briefly states that as long as you are able to draw a line between the objects, they aren't colliding.
i haven't implemented it before so i don't think i would be able to help in its implementation.
there's an other way for dealing with polygon collisions which i often to. the trick is to treat every polygon as a circle and use the simple Pythagorean theorem to determine if the (pseudo) circles are colliding.
it is not the best but often does the job. at least when you don't want to use SAT.
+ 1
Calviղ or even simpler, a physics engine?
0
maybe you meant this
https://code.sololearn.com/W5G5lp23MNJg/#js
0
Calviղ Farry Just tried it, didn't work 😂
https://code.sololearn.com/WgEhP6AzzLBw/?ref=app
This is so hard! 😅