This project has moved and is read-only. For the latest updates, please go here.

resizing a colliosion geometry please help

Topics: User Forum
Feb 3, 2009 at 5:06 AM
im trying to get a geometry to resize

i create this collison outline using a texture2d in xna
but i need to make 8 different sizes of the collsion for the 8 sizes that i render the sprite scaled at

any ideas or funcitons in farseer or that anyone has made to do such a thing
or is it not doable?

thanks in advance :)
Feb 3, 2009 at 6:24 AM
what might work is if you extract the Vertices class out of your geom, then multiply each entry in the vertices (of the cloned geom) by the amount you wanted it scaled by, and feed it into a CreatePolygonGeom function. Do this for each version you want and it should work. if it works, then you're welcome!
Feb 3, 2009 at 4:19 PM
What RCIX tells you is very close to what you need to do.

You will need to create 8 different geometries before you need them (preload them by creating them before your game starts). You can use the Vertices.Scale() method to scale your vertices (added in 2.0) in the 8 different sizes.

When you need to resize your geometry, you just switch it out with one of the larger geometries (or smaller) and you should be good to go.
Beware that if your new is a lot bigger than the one before and you have geometries closeby, you will need to apply some force or something to push away the geometries closeby or else they will get stuck inside the geometry you just switched out.
Feb 4, 2009 at 12:02 PM
thanks i think that will work great

i will test tonight

genbox you give some great support on the forums youve helped me so much :)

also the broadphase benchmark in the simple collsion test project number 8 i beleive
has a small bug (well i thought it was lol) where some of the dots spawn inside the level boundarys down the bottem
by moving them just 30 pixels up the framerate on the 360 gos from 2 to 90fps

but if im wrong just ignore me lol
Feb 4, 2009 at 5:18 PM
No problem. I'm trying my best.

As for the samples. I've been noticing some performance problems too, I will take a look at it. Thanks.