Collision: Vector class (java)
Posted
by
user8363
on Game Development
See other posts from Game Development
or by user8363
Published on 2012-03-29T19:16:35Z
Indexed on
2012/03/29
23:42 UTC
Read the original article
Hit count: 228
When handling collision detection / response and you need a Vector class, do you need to create that class yourself or is there a java class you can use?
A vector class should have methods like: subtract(Vector v)
, normalize()
, dotProduct(Vector v)
, ...
At the moment it seems logical to use classes like java.awt.Rectangle
and java.awt.Polygon
to calculate collisions. Would I be right to use these classes for this purpose?
My question is not about how to implement collision detection, I know how that works. However I'm wondering what would be a correct and clean way to implement it in java since I'm fairly new to the language and to application development in general.
© Game Development or respective owner