Body/Geom Scaling & AABB Rotation

Topics: Developer Forum, User Forum
Jun 18, 2010 at 4:41 PM

Hello All,

I have a couple quick questions again :)
I did look through the forums and couldn't find an answer and I'm fairly new to the gaming/physics scene so here goes:

1.  Using the engine, I was able to create an in game editor and its working beautifully.  However, I want gamers to be able to scale my entities when editing.  From 0.1f to 1f.   I can scale polygons in realtime (because of a forum post), but I can't seem to figure out scaling Rectangles and circles at runtime.
Is there a way to scale rectangles, circles, etc in realtime without having to recreate the Body and respective Geom?

2.  I'm using the "Hairdryer" from the demo project to create a fan in my game.
How do I rotate the AABB with the Geom.Rotation?  I saw something on the web to use OBB, but I don't see that in Farseer.
Is AABB a good fit for my situation, or should I use a different approach?

Code examples pretty please!

Thank you in advance,


Jun 20, 2010 at 6:27 AM
I'm not sure about the first part, you could try destroying and recreating it on the fly if they don't want to scale? About AABB's, you don't rotate them. That's the point. They are axis aligned (hence the AA). Why would you want to do that? They are used as part of an algorithm to calculate collision's, so you shouldn't want to mess with them. Turn off Debug view (PhysicsSimulatorView) and you don't see them any more, which is maybe what you want.
Jun 20, 2010 at 4:08 PM

Thank you Jerky for the reply.

1.  If that is the only way to scale Bodies and Geoms, then that's what I'll have to do.

2.  I do get the AABB concept now and I assumed that OBB (the object aligned bounding box) is what I need, however I don't see that in the physic's framework.  
I guess to be a bit clearer, I want to have a fan that can rotate 360 degrees and I want the object detection to rotate with the fan's body.  There is probably a simple solution to this but I didn't want to guess, I'd like to get it right the first time.  Perhaps I need to Weld another body that extends outward and subscribe to the OnCollision event and ApplyForce there?

Jun 24, 2010 at 5:58 AM
You should check out the examples. You also might want to get the FP3 source and check out the test bed examples there too. They are far more advanced than the FP2.x examples, and there are some motors and other things in action that might match up with what you are envisioning. I found that was the best way for me to learn about FP (to check out and hack any examples that did similar things to what I was trying to do).
Jun 24, 2010 at 3:56 PM

Thank you Jerky.  I'll have a look at the 3.0 source to get more ideas.  I totally agree, poking around in the example code has helped me a lot.  
I try hard to find the solution there before I post anything in the forum, I like to save my keystrokes for programming instead of posting if I can :)

When I'm finished with my solution I'll post my code in case it helps anyone else.