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

# Simple Engine Questions

 Topics: Developer Forum Wiki Link: [discussion:214431]
 PigFooker May 31, 2010 at 9:14 AM Hello Everyone, I have a couple, hopefully easy, questions: 1.  Where do I find a png version of the logo so I can give proper credit to this awesome engine in my game. 2.  Given the PERFECTLY FLAT 2d plane I'm working with, how do I determine that an object is nearly or has stopped moving 100%? 3.  I'm currently using Impulse to launch an object, what is the proper way to apply initial spin at the time of the initial impulse?  I tried assigning a value to the body's rotation before and after the impulse, but it seems to be ignored no matter which order I apply it. 4.  This is wishful and open for suggestion, I'm using "OnCollision" event to apply sound variation... Does anyone have a good approach to a believable pitch or volume variation based on the magnitude of impact?  Currently I'm using contactlist[0].Separation to get the largest impact and applying it to the sound volume, but I'm having troubles determining a threshold of separation to merit a sound without making the sound card stutter.   Right now I'm doing: float Separation = contactlist[0].Separation;             if (Separation < -0.16f){ SoundEffectInstance fx = soundFx.CreateInstance();               fx.Volume = MathHelper.Clamp(Separation / -1, 0, 1);                 fx.Play();            } There is probably a better/more realistic approach and I'd be more than happy to hear some suggestions. That is pretty much it for now... I would post some code where I attempted to solve these on my own, but I think it would detract from a best fit since I'm very new to your framework. Thank you for such a great tool and thanks to all that reply in advance, Nick pnikosis May 31, 2010 at 11:25 AM 1) No idea, but it would be good to know 2) float absVelocity = body.LinearVelocity().Lenght(); if absVelocity is near zero, well the object has stopped :) 3) body. ApplyAngularImpulse(value) would make your object spin 4) for the magnitude of the impact, you can use the velocity of the colliding object. In the OnCollision method you have 2 geoms, the second one is the "other" object, then you have float magnitude = geom2.Body.LinearVelocity() * geom2.Body.Mass   Hope this helps :) PigFooker May 31, 2010 at 8:16 PM pnikosis, you are awesome!  Thank you, that was exactly what I was looking for! For item #4 I changed it up to use geom1, since in my case, geom2 is 9 times out of 10 a static body. I'll keep an eye out for a clean png logo, otherwise I'll just use the jpeg on this site and make it work. nornagon Jun 1, 2010 at 12:34 AM You might want to use the relative velocity of the two objects... you could imagine a situation where two things that are going at about the same speed in the same direction collide, in which case they could have touched very gently (but would still be going fast). Similarly, if two things are flying towards each other at the same speed & they crash into each other, they have crashed at twice the impact that they would have if one was standing still. Thus: float magnitude = (geom1.Body.LinearVelocity() - geom2.Body.LinearVelocity()).Length(); Theoretically you should include angular velocity in the calculation, too... PigFooker Jun 1, 2010 at 12:55 AM Thank you nornagon, that makes perfect sense and the results are great. Since you are labeled as a Developer, do you know where to find a png version of the Farseer logo? Pnikosis Jun 1, 2010 at 3:25 PM nornagon you're right, it's better the relative velocity, and plus you can multiply each velocity for the respective mass to get a somewhat equivalent to the force applied :) genbox Jun 2, 2010 at 12:39 PM You can find the best version of the FPE logo here: http://farseerphysics.codeplex.com/wikipage?title=Logo PigFooker Jun 2, 2010 at 4:54 PM Thank you genbox!  No transparency but I'll work with it, thanks again! Great job on the engine by the way.  I have one more question, but I'll save it for another thread.