Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


XNA + Camera2D + PerPixelCollision


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Plutonium   Members   -  Reputation: 349

Like
0Likes
Like

Posted 09 February 2013 - 02:40 AM

Hi, everybody smile.png

For some time playing with XNA 2D. I implemented Camera2D from tutorials: it have move, rotate and zoom. It work pretty good with simple Rectangle collision. But then I try to do PerPixelCollision with zoom - boom, game crashes. On method Texture2D.GetData(Color[]). Error says: The size of the data passed in is too large or too small for this resource. But if I dont zoom - works perfectly.

Maybe somebody have same problem?

 

I adding project (visual studio 2010), maybe somebody will know what doing not right. All logics about game objects is in Entity, in end of UpdateEntity, and next method is PerPixelCollision

 

Uh, was forget to add project. Now tried, and didn't let to add, so there is link: https://www.dropbox.com/s/gimojdfhdzspzpl/TestGame.7z



Sponsor:

#2 bollµ   Members   -  Reputation: 354

Like
0Likes
Like

Posted 09 February 2013 - 09:09 AM

I don't use XNA at all, but, isn't XNA dead? (Miscrosoft isn't supporting it anymore, last I heard).

 

I'm sorry I don't have an aswer, but I'm curious as to why you're still using XNA :)


a WIP 2d game engine: https://code.google.com/p/modulusengine/

English is not my first language, so do feel free to correct me :)


#3 Plutonium   Members   -  Reputation: 349

Like
0Likes
Like

Posted 09 February 2013 - 09:14 AM

I don't use XNA at all, but, isn't XNA dead? (Miscrosoft isn't supporting it anymore, last I heard).

 

I'm sorry I don't have an aswer, but I'm curious as to why you're still using XNA smile.png

Just today saw that XNA is dead, but for learning if think get some good experience from it :) Later what I learn now with XNA, I will able to adapt to other API ;)



#4 Orangeatang   Members   -  Reputation: 1674

Like
1Likes
Like

Posted 09 February 2013 - 10:56 AM

I don't use XNA at all, but, isn't XNA dead? (Miscrosoft isn't supporting it anymore, last I heard).

 

I'm sorry I don't have an aswer, but I'm curious as to why you're still using XNA smile.png

Just today saw that XNA is dead, but for learning if think get some good experience from it smile.png Later what I learn now with XNA, I will able to adapt to other API ;)

Check out http://www.monogame.net/

 

Based on XNA, supports almost any platform you can think of and has an active development community.

 

Also - do add your project or the code that's breaking down... very hard to debug otherwise :)


Edited by Orangeatang, 09 February 2013 - 10:59 AM.


#5 precious roy   Members   -  Reputation: 126

Like
0Likes
Like

Posted 10 February 2013 - 10:50 AM

Hello Plutonium,

 

i haven't looked at your code but have you tried calculating the collusion before you draw everything zoomed in?

 

so after calculating you do the math for the zoom.



#6 LordRhys   Members   -  Reputation: 364

Like
0Likes
Like

Posted 20 February 2013 - 01:03 PM

I agree with precious roy, the collision code should come before you ever get to the render code, the zoom function of your camera should be part of your rendering not your update. While you may have the change from normal display to Zoom and back in your update code the actual change in the screen output is part of render. I don't use perPixel collision, I use a collision radius system with an origin point but my collsion code works Zoomed or not.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS