Question

I would like to downsize a Texture2D object to another Texture2D object in XNA.

The reason is to use the downsized object for pixel based collision detection.

Can this be done?

Was it helpful?

Solution

You should take a look at the per-pixel collision tutorial as well as the transformed per-pixel collision tutorial.

Essentially, to do collision detection on a transformed texture (such as a scaled one like you want) you use a transformation matrix. It's not overly difficult and the tutorials give a good example. The tutorial doesn't scale but rotates, but comments are include in the source that show you where and how to do scaled as well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top