This site requires JavaScript, please enable it in your browser!
Greenfoot back
s1ice
s1ice wrote ...

2022/2/17

Irregular Object Collision

s1ice s1ice

2022/2/17

#
I've been working a bit on a program and I was wondering if there was a way to detect collision of two non-rectangular objects. I have an object with a triangular shape, and whenever my mouseDetector object touches the corner of the PNG boundaries (not touching the visible part of the triangle), it counts as a collision. Is there any way to work around that?
danpost danpost

2022/2/18

#
s1ice wrote...
I have an object with a triangular shape, and whenever my mouseDetector object touches the corner of the PNG boundaries (not touching the visible part of the triangle), it counts as a collision. Is there any way to work around that?
You could add boundary actors to the triangle shaped actor and check for collision with them.
danpost danpost

2022/2/18

#
danpost wrote...
You could add boundary actors to the triangle shaped actor and check for collision with them.
I uploaded a demo. You can view the source while running it.
s1ice s1ice

2022/2/19

#
Thank you so much for this, really appreciate it.
You need to login to post a reply.