I am trying to make a simple game where one object is moving between to curvedVertexes.
Now I want to add an event incase the object is colliding with the obstacles aka the curvedVertexes. I have found “collidePointPoly()” ( https://github.com/bmoren/p5.collide2D#collidepointpoly) to be a simular case. But once I have tried it out, the function stayed false even if there was a collision.
https://glitch.com/edit/#!/wave-collision?path=index.html:181:1 (this is the link to my glitch project, since I find this the easiest to share)
lowerhit should turn true, once the ball enters the tourquise area.
Does anyone know why this is not working?
Thank you very much for the support
Not sure why the collision code isn’t working
I do however have an alternative. It’s not p5.js, but I’m sure it should be easy to implement.
The only problem is the collision isn’t accurate. I made an example where it’s clear what the difference between the graphic and the collision would be :
The only way I can think of to fix this is somehow extracting the vertex data from the curveVertex and using that to define the polygon
Thank you for your response.
Could you help me?
Combining automated deployment, instant hosting & collaborative editing, Glitch gets you straight to coding so you can build full-stack web apps, fast
Thank you in advance
I’m afraid I’m too unfamiliar with p5.js to convert the code
But I did manage to find a resource full of conversion tips on github
p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Proces...
I hope this solves trying to make the boolean work
You might be interested in this recent discussion of finding an intersection on a curve using line-line detection, where each part of the curve is a line segment.
First, let me lay out what I’ve done so far and what I’m trying to do with this partially completed program.
I’m attempting to convert the RGB pixel values to their corresponding wavelength by:
Converting RGB to XYZ [check],
Converting XYZ to Yxy [check], and
Defining the dominant wavelength of xy [in progress].
The process of calculating the dominant wavelength of xy is laid out in [1,2]
and summarized as follows for my purposes:
'Construct a line between the chromaticity coordinates of …
You could use circle-line collision detection in a similar approach.