Tag Info

Hot answers tagged

2

Mirroring an object happens only across one plane; it's not a global -1 scale, as you've done here. You only want to set the scale to -1 for one of the X, Y, or Z axes (Which one depends on which direction you want it to be mirrored). Leave the other two axes with a scale of 1.


1

Attach the script to the object itself and you can manipulate it in the built-in Start (Reference). It's similar to the Update function except instead of being called every frame it's called when the script begins. public void Start () { DoStuff(); } There's also the function Awake (Reference) which is the same except happens earlier in the ...


1

Without more details I can't be certain if this is an acceptable solution but you might instead take the approach of scrapping the colliders completely and simply comparing the distance between the 2 objects transform.position on drop. Alternatively, you may be able to use the information from the bounding boxes (available via the renderers) to work with ...


1

The first parameter in Invoke takes only the name of the method you wish to call. Assuming PositionScript.instance is set to a MonoBehaviour component of some sort: PositionScript.instance.Invoke("MAttack",5f);


1

I believe all you need for this is some ambient lighting (light that is allways there, even in the dark parts), and a diffuse light. Instead of enabling default lighting, call cubeEffect.LightingEnabled = true; cubeEffect.AmbientLightColor = new Vector3( 0.3f, 0.3f, 0.3f ); cubeEffect.DirectionalLight0.Enabled = true; ...


1

You need a directional lighting. Also disable specular lighting if you want screen position not to matter. This type of directional lighting is achieved by: float lighting = saturate(dot(normal,lightDirection)); But you can enable it in a BasicEffect, too. If you want speculars gone, turn down the material's specular intensity to zero (you can also do it ...


1

This is because the sprite batch hijacks the graphics device's states when you use it. You need to cache them before using the sprite batch and then restore them afterwards. (Or you can set them directly afterwards without caching if you know the ones you want to use.) // cache device states var blendState = GraphicsDevice.BlendState; var depthStencilState ...


1

I am not quite sure what you are not understanding here, but I attempt to answer your question anyway. I am not quite getting what that does or what purpose it serves. In cases where you do not fill in the fields in the inspector (which requires them to be public), you need to find the instances of the needed components in code. The ...


1

So , as already was sad there are no pixels in 3D spcae at all. There are usints that dont have any relations with 2D pixels. Pixel are also units, but they have fixed size couse screen have have fixed resolution. For example if your monitor is 12 inches in width and 9 inches in height and resolutins is set to 800x600 one pixel will have real size ...


1

Like dustin said, the size of a 3d object isnt measured in pixels. But if you wish to scale it, change "world = Matrix.CreateTranslation(10.0f, 10.0f, 0.0f);" to "world = Matrix.CreateScale(2) * Matrix.CreateTranslation(10.0f, 10.0f, 0.0f);". Notice that I put the scale factor matrix BEFORE the translation. Otherwise, the translation would also get scaled. ...


1

[EDIT] (Original post below) I found an even simpler way of doing this, using the TimeSpan class. I also updated the class to be semi-singletonish, with an 'Instance' property that gets auto set in the Awake event. (Just make sure not to use this before it is 'Awoken') You only need to add this script to any existing game object in your scene, and you can ...



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