Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

triangle - rectangle collision noyt happen

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I make 2 objects(1. triangle (java.awt.polygon) and 2. rectangle(java.awt.rectangle)) and moved these objects by TIMER . My aim is to make these 2 objects collide and bounce back each other. The problem is Why they are not colliding and bounce (they only overlapped each other), when i used the (..if(intersect..) part(refer code below). The compiler(cmd) encounter error saying ["no suitable method found for intersects(Polygon)"].

i feel weird because before this when i create 2 rectangle(use java.awt.Rectangle) and using the (..if(intersects)...) it work perfectly. These 2 rect touch and bounced each other. I stuck at these part and I need a DEEPER answer to this, what does the error mean ? Thanks




 
Rancher
Posts: 4801
50
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do it the other way around.


The intersects method of Rectangle only takes Rectangles, and a Polygon is not a Rectangle...
 
don krieg
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dave Tolls , thank you so much for your answer. Now i know the reason. Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic