Tag Info

Hot answers tagged

2

Yes, you can do this with no expensive trig at all. Steps: Find the distance between the 2 circles. Find the combined radius between the 2 circles. Subtract the distance from the combined radius to get the depth of the penetration. Multiply the direction between the circles by the penetration depth. I.e.: Circle c1; Circle c2; float Distance = ...


2

One way to do this, is to draw your text 2 times in a different color at specific offsets. For example: public static void DrawText(SpriteBatch spritebatch, SpriteFont font, string text, Color backColor, Color frontColor, float scale, Vector2 position) { Vector2 origin = Vector2.Zero; spriteBatch.DrawString(font, text, position + ...


1

You can access the material of the lamp object in the Unity-API. public GameObject lampObject; public bool isGreen; public Color greenColor, redColor; private void Update() { lampObject.material.color = isGreen ? greenColor : redColor; } This will set the material color of the lamp to a specified value you can edit in the inspector. It is also ...


1

I think you might be overcomplicating things - why not just set the "origin" of the hook to new Vector2(0, hookTexture.Height / 2) If you simply draw it like this: spriteBatch.Draw(hookTexture, position, null, Color.White, rotation, new Vector2(0, hookTexture.Height / 2), 1.0f, SpriteEffects.None, 0.0f); That way the hook is drawn and rotated around ...


1

http://answers.unity3d.com/questions/16603/is-there-a-global-volume-setting.html Use the slider's value to determine the AudioListener.volume static field. http://docs.unity3d.com/ScriptReference/AudioListener-volume.html It is between 0 and 1. You can get a normalised( between 0 and 1 ) value from the slider using Slider.normalizedValue.


1

This is not directly possible in Unity because: There is no difference between sound and music for the Audio Sources The volume of every Audio Source is independent of eachother You will need to search for the Audio Sources in your local scene to iterate through them with Object.FindObjectsOfType. var audioSources = ...



Only top voted, non community-wiki answers of a minimum length are eligible