Skip to main content
Order and grammar clarifications.
Source Link
Anko
  • 13.4k
  • 10
  • 55
  • 82

Collision: Vector What Java class (java)should I use to represent a Vector?

WhenDoes Java have a built-in Vector class suitable for 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 It should have methods like: subtract(Vector v), normalize(), dotProduct(Vector v), ...

At the moment itIt 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. Howeverunderstand collision detection; I'm only wondering what would be a correct and clean wayapproach to implement it is idiomatic in java sinceJava. I'm fairly new to the language and to application development in general.

Collision: Vector class (java)

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.

What Java class should I use to represent a Vector?

Does Java have a built-in Vector class suitable for handling collision detection / response? It should have methods like subtract(Vector v), normalize(), dotProduct(Vector v), ...

It seems logical to use java.awt.Rectangle and java.awt.Polygon to calculate collisions. Would I be right to use these classes for this purpose?

I understand collision detection; I'm only wondering what approach to it is idiomatic in Java. I'm new to the language and to application development in general.

added 3 characters in body; edited tags
Source Link
House
  • 73.3k
  • 17
  • 185
  • 273

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)subtract(Vector v), normalize()normalize(), dotProduct(Vector v)dotProduct(Vector v), ...

At the moment it seems logical to use classes like java.awt.Rectanglejava.awt.Rectangle and java.awt.Polygonjava.awt.Polygon to calculate collisions. Would I be right to use these classes for this purpose?

-- I'm not having a My question onis 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.

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?

-- I'm not having a question on 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.

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.

Source Link
user8363
  • 600
  • 1
  • 6
  • 14

Collision: Vector class (java)

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?

-- I'm not having a question on 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.