Tag Info

New answers tagged

0

I am not sure if projection is actually the correct word for this, but I hope it is what you are looking for. First you need the planes normal which is the cross product of the directions from one of your vertices to two of the others, which in case of your image could be C-A and B-A. (the three vertices may not lay in the same line, there is a simple ...


1

Autodesk has a FBX Converter, which can take .objs and output .fbx. Included is a command line tool, which you could call from your game at runtime. As long as you do not want to have that functionality distributed to every player, that should be enough.


0

Depending on the requirements of your game, you'll only need to use RPC calls. That will require a NetworkView component (which you can set Observed to None, and State Synchronization to Off).


1

Uncheck the "Play Automatically" checkbox in the Inspector (Animation section). Obviously make sure you select the appropriate GameObject or prefab first. Then use animation.Play('yourAnimationName') in the appropriate event handler.


2

Typical bloom effects are applied as a post-process to the entire rendered frame. This makes it difficult to bloom only select objects. Even windowing the bloom to a region around the lines risks blooming unrelated content that comes too close. Instead, you can try "pre-blooming" your LineRenderer content - using a wider ribbon and baking a soft surrounding ...


0

I have a 'full width UI' script that deduces the aspect ratio of the screen relative to some reference screen dimensions, and adds a scale to the transform to compensate for a change in aspect ratio. Then I build my UI to the reference screen dimensions (in my case 1024 x 768). At runtime, the actual screen width is asked for, and the adjustment ratio ...


1

Without seeing your code, it's hard to give on solid answer, but here's an idea that might help you: The tail always points away from the previous piece of the snake. If we see the last piece of the snake as the tail, then the one that comes before it gives the direction of the connecting end of the tail, and the opposite direction is then the direction of ...


5

Plugins for Unity can be written using Objective C; refer to this page: http://docs.unity3d.com/Documentation/Manual/PluginsForIOS.html However I wouldn't assume that a code library of thousands of lines that wasn't designed to be used as a Unity plugin will work as a Unity plugin. It's all free so you could download Unity, fire up the demo project, and ...


0

As Savlon said, this can be done as in the Tower Bridge Denfense demo. Basically you just have to separate the feet from the rest of the body using the sprite editor (slicing the different parts of your sprite asset). The feet will be children of your main player object. After that, you just need to create a new walking animation for the whole character and ...


1

I'm not sure if this is new since the answers in 2012, but Unity actually does have support for timeline control via the (Legacy) Animation Editor. Although this feature is intended mainly for animating object parameters with curves, it includes the ability to trigger scripts on Animation Events. These scripts could drive your graphics and audio.


0

If you are using Mecanim (which, by your question, I guess you're doing), you can create for example a trigger variable in the Animator, and set it from your code wherever you want. Triggers are basically like booleans, but you don't specify any true/false value. Instead, you just set them from your code, and they will be "true" just for a moment. After the ...


0

If you are using the legacy animation system you can simple call Play from the Animation component. For mecanim I think that you need to change some variable into animation state machine that triggers the animation, check out: https://docs.unity3d.com/Documentation/Manual/StateMachineBasics.html ...


3

Go to your assets window and click on the image. On the inspector, you will see the import resolution. Switch it to 2048 (it is 1024 by default). You can play with the different filter modes too. For example, I'm developing an old-school kind of game with big pixels, so I set the filter mode to "Point", so that sprites don't get shady.


1

When building your game, Unity will not include all the scenes by default. Ensure that your scene is included and checked in the build window. The build settings window appears after selecting build and displays the currently selected scenes to be built. You can also find it by selecting File->Build Settings. You may need to add the scenes yourself and then ...


0

For the main menu screens if you are using UnityGUI, you can use more than one camera for different GUIs, in one scene. For example, when you press Play at the start menu, the current camera turns off and another camera which shows, say a Car Selection menu, turns on. All these happens in one scene.


2

I'm working under Unity, and I'd like to know if it would be possible to somehow query the material + shader of each GameObject that has a Mesh Renderer attached to itself, in order to find out how much light has fallen on the 3D model. As per Unity's documentation, Unity does not provide such functionality, so it's not possible to achieve what you ...


2

You could change the GameObject's hideFlags? I just tried running this: GameObject myGameObject = new GameObject (); myGameObject.name = "Obvious Name"; myGameObject.hideFlags = HideFlags.HideInHierarchy; ...and it's there, but it's not in the hierarchy. Technically, it's in the scene, but you don't see it until you change it's flags back to ...


1

The general rule is that a scene is a thing that has it's own distinct processing regimen. If none of the logic running is the same as that of another part of the application, then they should be two distinct scenes. OTOH, if for instance you are doing level flythroughs behind your main menu (think MineCraft), then you probably want to adapt your in-game ...


3

It depends on the usage. If you have a menue that is shown upon the start of game ( e.g. main menue ), then it's quite obvious that you want to treat it as a scene. However, when you have simple little menu that is used quite often then it's not really wise to reload the scene each time. Especially when you're having some pause menu.


0

Rigidbody2D controls the physics, but your character needs a Collider2D as well otherwise no collision will occur. - Character GameObject - Collider2D - RigidBody2D - Any GameObject that character will collider with - Collider2D


0

AFAIK, yes, the parameters can only be changed via scripts. To stop the game logic from allowing more shooting, you should NOT be making a parameter here. The Animator doesn't need to know anything about that, it only cares about animation blending and transitions. Make a private boolean variable in the script that actually triggers the shooting and don't ...


1

GUIStyle myStyle; void Start () { myStyle = new GUIStyle(); Font myFont = (Font)Resources.Load("Fonts/comic", typeof(Font)); myStyle.font = myFont; myStyle.fontSize = 50; } void OnGUI () { GUI.Label(new Rect(10,10, 100, 30), playerName, myStyle); }


2

Use GUI Skins. Create a new skin (go to Assets -> Create -> GUI skin), customize it accordingly (you have options for each kind of control), and link it to your script. public class YourScript : MonoBehaviour { public GUISkin Skin; ... public void OnGUI() { GUI.skin = Skin; GUI.Label(new Rect(10,10, 100, 30), ...


1

Why do you need a public array for that? If you just want to create GameObject by drag and dropping you can do that in the Scene hierarhcy. If you need to access them later in a script then you can declare a public list: public List<GameObject> myList = new List(); Then just drag and drop the objects to that list.


1

You can freeze rotations of a Rigidbody.


2

Here's a technique I experimented with recently. My RenderMonkey prototype shows a section of badlands-style canyon, but the same principle should work in caves. The idea is to start with tiles that are generic, downright boring, with simple predictable edges so they're easy to line up without seams or gaps: These starting tiles could be shapes you've ...


0

Just add a parent transform to the object, make the transform aligned with your model's expected axis, now use the parent transform to reference the child object.


2

Add a character controller and use controller.move() with this you can make your character don't walk through the walls, if this wall have a collider.


0

But if your model don't be modeled to get the axis z to front in the modeller program you can't arrange this in unity


0

Scale in script: gameObject.transform.localScale = new Vector3(2,2,2); in the numbers you set the scale to each axis of your gameObject. edit: like Esa say you need to do this in each part of your model, but you can make it in a bone of skeleton of animation that create the effect you need.


2

Here's another approach to procedural generation that hasn't been explicitly mentioned yet: spline skinning. You can use a version of Hermite Splines (which provide a curve interpolating positions and tangents) to define the curves: when it's time to generate a new segment, just choose a position (roughly in the direction of the previous segment, as bcrist ...


1

You shouldn't multiply jumpStep by Time.deltaTime. It should always be the same value, regardless of frame rate. You should multiply currentGravity by Time.deltatime. In the last part, you should do currentPos.y + ySpeed * Time.deltaTime, When you use speed to compute movement, you need to multiply speed by time. That is because jumping is an impulse and ...


3

Unity has the scale component in every transform. You can then scale the x,y,z of the model. So in theory if you have a model with separated body structure so that arms, legs and head are all individual GameObjects you can scale them individually.


0

Try using transform.up and transform.right instead of Vector3. Vector3 takes the world coordinates and transform.up takes into account the transform's orientation.


6

There is rarely a "right way" or "wrong way" when it comes to game design. There are many, many ways to solve this problem, but here are a few possible approaches to explore: Constrain the tunnel pieces to both start and end only in certain directions; for instance only along the axes. Then you just have to keep track of the offset from the beginning to ...


2

You could model your cave as a sequence of points, each with an associated size, with lines connecting them. Then treat each point and line as metaballs and metacylinders. This gives you a basic shape for your cave, to which you might want to start adding variation, such as by randomly offsetting vertices.


1

One way of doing this is using min blending. With Unity this can be set up in ShaderLab using the BlendOp command. If your objects are all monochrome as seen here, you may simply be able to use min blending directly on the objects as they're rendered and avoid having an alpha channel at all. (White is transparent when using min blending.) Min blending ...


2

You can't. Unity doesn't have an interface for creating GUI interfaces in the editor. Further, there may be extensions for this in the Unity marketplace, but it's highly unlikely you'll be able to get away from any coding at all. There's still going to be the requirement to connect the GUI to your game, and many of those interactions are going to require ...


1

It looks like the endpoint configuration in your app.config is missing in Unity. The exception points to the "ctor" or constructor. The fact that it errors on the "InvalidOperationException: Client endpoint configuration '*' was not found in 0 endpoints." makes me believe that it cant find the configuration for that endpoint. It probably needs that, so that ...


2

The only way to do this is to make an empty gameobject and then put the object you wish to animate inside it, then putting an animator on the new parent. For example, here you would put the tree and leaves in a parent object, and transform the parent object as needed while the animation plays relative to the parent.


0

This is untested, but it should get you on the right path. You can replace "Platform" with whatever layer you end up putting your platform cubes in. if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; // An arbitrary distance value. Increase or decrease this value, or you could set to ...


1

I have done this before in a quick and dirty way - using colliders. Put a collider and a script with an OnMouseDown method on the prefab, the method will trigger when the tile is clicked


2

You need to rotate the object 180 degrees on the X-axis instead of using scale for this. Use: http://docs.unity3d.com/Documentation/ScriptReference/Transform.Rotate.html


1

You will have to use a plugin to do that. I've used this one and it was straightforward to set up and use (works for both iOS and Android): https://github.com/faizann/UnityGPGPlugin Some things to keep in mind (because the debugging log messages shown won't help you understand what really happens, all of them reporting that the application w/ the given key ...


1

I was thinking wrong. I do not more passes to receive every light in the scene. I took a shortcut and used a surface shader in the end. I post it here for reference Shader "Custom/Test01" { Properties { _MainTex ("Texture (RGBA)", 2D) = "white" {} } SubShader { Tags { "Queue" = "Transparent" ...


0

Use the excellent Unity Sprites and Bones: https://github.com/Banbury/UnitySpritesAndBones Didn't make it to the asset source due to being completely free and open source. It has inverse kinematics and you can use it for this use case.


1

You need a couple of things here - Something that will randomly spawn things Some way of knowing where sprites already exist so you don't spawn there It looks like you have a handle on the former so I will cover the latter here. For unity sprites you have a component called SpriteRenderer from which you can obtain the size of a sprite: Vector2 size = ...


10

There are two ways an AI controlled unit with a bound rotation speed and an adjustable movement speed could reach a goal. First, lets consider the challenge we are presented with so we could understand it better: If the player is moving and rotating in constant speeds while trying to reach a goal that is on its right or left side, it will move in circles ...


1

You can add the following attribute at the beginning of your script class: [RequireComponent (typeof (NetworkView))] This will ensure that whenever your script is added to a GameObject, a NetworkView component will also be added to that GameObject. Or you can just manually add the NetworkView component yourself. If you're only using it for RPC, you can ...


1

Yes you can : Table_Manager TM = your_game_object.GetComponent<Table_Manager>(); NetworkView nv = TM.GetComponent<NetworkView>(); nv.RPC("get_score",RPCMode.All,25);



Top 50 recent answers are included