Tag Info

New answers tagged

0

The block of code you posted is working fine. First of all, be sure your player has a 3D collider ( box, capsule, etc ) in it. Second, be sure to change the material color in one spot only. If the color is blinking, maybe you're changing it in two different updates. Third, I don't think it is the source of the problem, but Unity documentation encourage ...


0

Sorry, but I can't comment yet, so, I will post as an answer. Just to be sure. I suppose you're not moving the top 2D Side Controller around, right? It controls the touchpad position and should stay in the place. If you need to move the player, move the "Player" object instead.


1

For a landscape game, where I built the scene around a 16/9 ratio, I used this script to handle the camera.ortographicSize property dynamically at game startup, to have a constant of X number of unity units on the width regardless or device resolution and aspect ratio. Also if necessary you can modify it to help you align the scene to screen bottom or top ...


0

a) Highlight adjacent tiles from current tile: use a modified floodfill with depth parameter to get all the nearest tiles within X depth/distance. b) allow GO to move on any of those adjacent tiles: the said floodfill should return a list of tiles, check if clicked tiled is in the list, if so, move GO. Edit: A possible implementation of said floodfill (in ...


1

Unity colors have 4 float values typical of many color formats RGBA, corresponding to the individual percentage color values Red, Green, Blue and the Alpha transparency channel. Also as mentioned above the default "Tint" applied by Unity is a multiplicative shader Photoshop calls this effect "Multiply" and the process is literally multiplying the color ...


1

Using the current version of Unity 4.6 I experienced and resolved a similar issue: My GUI interaction had become non-responsive and unpredictable whilst performing other actions (Particularly while moving the player with keyboard input WASD). My resolution was disabling "Send Navigation Events" from the Event System that was managing my canvas ...


0

Within this project, you are able to define what is passable and impassable terrain. If you recast the graph and alter the maximum slope that's walkable to the gradient of your mountains, they should be included in the navmesh, albeit at a higher cost to use. There may be other ways, but ultimately, what you want to be looking to do is include the mountain ...


0

I don't have my copy of unity to hand right now to try it out, but I couldn't find any way to move gameobjects using the keyboard. However, I did find this page full of keyboard shortcuts. Also, if the issue was not having enough precision with the mouse, you can always use snapping to make sure that the vertices and objects align properly.


1

You might be able to use a combination of the two approaches. You could turn off the collider of the thrown object when it's lifted, and use a simple, invisible, collider placed on the body like so: You could then fire this collider directly out from the body. It should be on the same plane as the player and the enemies, so it seems like handling hits ...


0

From Solution tab inside MonoDevelop click on the settings icon and close all projects. Then you can try to re "Sync MonoDevelop Project" from Unity.


0

You might check to see if the triangles in each index variant are still listed in the same order (for instance, sometimes it's A0 B1 C2 D3, sometimes it's B0 C1 D2 A3, but always the same triangles come before and after each other in the index). If that's the case, you might be able to calibrate when you instantiate your gameobject by shooting a raycast at ...


2

There is a different way. Instead of: child.transform.parent = parent.transform; Use: child.transform.SetParent(parent.transform, false) The false argument specifies to not perform the relative adjustment you are talking about. I'm guessing the reason it doesn't do this by default is because the code is most typically called from the editor, in ...


1

http://docs.unity3d.com/ScriptReference/Ray.html This shows us that ray takes 2 parameters; an origin( the place the ray is being cast from ), and a direction. This is where your code is wrong, you pass in the enemy position for an origin, and pass in the player's position for the direction. A direction should be a normalised vector. To get the direction ...


0

For future reference: Anim8or is a 3D modeling and character animation program in development for over decade. It is very accessible for beginners and hobbyists. It is taught in schools and a lot of tutorials exist. Example resource: http://cyberdog.wikispaces.com/Anim8or-Saucer101 Manual: http://www.anim8or.com/learn/manual/index.html


4

Maya isn't the only 3D modeling package supported by Unity. Basically, anything that exports to .fbx will work (Unity imports that file format). The other most common options are 3ds max and Blender, the latter of which is open-source. But again, any tool that exports to .fbx (which is most 3D modeling software) will work.


1

While Unity doesn't come with any 3D modeling tools, you could (with a bit of work) achieve that visual style just by using the primitives built into it. Be advised, there are a variety of other 3D Modeling packages that you can use (other than Maya), that are far more affordable (see: free) for a new 3D modeler.


1

Just save the changes as the user plays? Am I missing something here? Either instantly (faster as you aren't saving the whole game at once, but the data adds up) or just regularly enough that you only lose a couple of minutes worth of data at a time (slower, as you have to save the entire game regularly, but uses less space) Or best-case, combine both - ...


3

If you know the start and end points as well as the desired length, you can use Vector3.Lerp Vector3 midPoint = Vector3.Lerp(startVector, endVector, 0.5f); Debug.DrawLine(startVector, midPoint);


8

You can simply get the vector pointing in the right direction, then scale it by the distance you want and add that to the initial point. This will define a new end point for your line. //Get the direction of the line Vector3 direction = point_B - point_A; //Get a new point at your distance from point A Vector3 point_C = point_A + (direction.normalized * ...


2

Other than to specify that "only one" is called, Unity does not guarantee any behavior in this case. The most likely scenario, which you can determine through experimentation, is that either the first RPC that becomes registered/known to the system is called, or the last one is. However, this is an implementation detail. Unity explicitly does not want you ...


0

Use the EventTrigger component for more events that aren't build-into the button element.


0

The model itself is not more costly to made but an additional texture is required. Depending on the artist a new texture has to be drawn or the bumpiness is created from a high detail version of the model. The is no general answer. Unity states Normal mapped. This is a bit more expensive than Diffuse: it adds one more texture (normal map), and a couple of ...


1

This post could be helpful. Its gist is, you don't use the character controllers, but make your own using the physics engine. Then you use the normals detected underneath the player to orient them to the surface of the mesh. Here's a nice overview of the technique. There are plenty more resources with web search terms like "unity walk on 3d objects mario ...


1

As you already guessed, you can't trust any server or client you do not have under your control. So you can't send processed results. You have to send requests to the server, indicating the actions that lead up to these results, and verify these requests against the master server's knowledge of the rules of your particular game. Even then, someone could ...


3

It's a little confusing as Unity conflates the organization of scene items with its transform hierarchy. There's no way to bucket or organization items without parenting them to another object. The best bet you will have is to make empty "folder" objects that have no components and no state but simply serve to be a named collection of objects. These folder ...


0

I have a simpler solution without using any physics or rigid bodies. For your character, it need to have both x,y position as position in screen and i,j as position on the grid with a flag called isMoving. When the character wants to move to i+1, j. Check if the cell at i+1, j is free. If so, set flag isMoving to true and set character i,j to i+1, j and do ...


2

This falls under the Single Responsibility Principle (see SOLID). Specifically: the spawn point should handle entity creation, rather than a manager you would want to either have a field on the spawn point or a parameter on the spawn method that would tell it what to spawn you would then use an ordinary trigger behavior (maybe called TriggerSpawn, with a ...


0

Actually, there's no ready response for your problem. You can solve it in a variety of ways. If you are working with a "tile-like movement", you can simple check the next tile to see if is passable and only compute the movement if it is. It's a simple check if you have a array representing your world. Or a limited raycast if not. Also, Unity documentation ...


2

Scene graph organization is guided by the various consumers of the scene - see answer to "Scene Graph as Object Container?" Fundamentally, the scene graph associates objects such that they share some logic, physics, position, and/or render state. So concerning organization-by-type, except for very simple games it would be a mistake to treat the scene graph ...


2

Best solution Run an OVR Mirror and display another output window on your projector/monitor. You can attach it to one of the OVR 'eyes' if you are feeling lazy, or create a new camera and run it from there for better performance. Using networking You would run the client in 2 ways: Directly answering your question: To Remotely see everything exactly ...


2

It turns out you can implement this using the event system. The PointerDown and PointerUp events can be used to track when the start and stop of the continuous touch. I'm currently using them, and they work fine. It's preferred to use events rather than checking on every frame, I guess.


1

You can use Blend Trees to change animation speed. First of all you should add float parameter to Character Controller. Then create Blend Tree and double click on it. It'll open Blend Tree editor. Select Blend Type 1D and select created float parameter. Add 5 same animations of reloading. Each animation in Blend Tree has two parameters: Threshold and Speed. ...


2

It's simply a floating point precision error and the reason why you shouldn't use float whenever you really care about precision (and try to avoid using direct comparison with them). Use double instead (but it has limited precision as well!).


1

In your code, movement() is being called every single update resulting in repeatedly calls completing after the first five seconds - this is not what you want. You want to call movement once and have movement repeat itself. There might be a better pattern which if someone else can show would be great, but something like the following should work and get you ...


0

You're setting your position equal to your velocity. Your velocity is very small because it's multiplied by delta time. This results in very small changes to your position, constrained to a very small area. Your object is moving, it's just not noticeable because the changes are so small. Additionally, all the small changes are not adding up because you're ...


1

If your touchables overlap, what you are "touching" is ambiguous unless you process the input by the z-order or user-defined precedence of the touchables (Code Clown's solution). You would have to handle this ordering of touch event receivers in a higher level of your code so that the touch event can be stopped by the first receiver in the hierarchy. The ...


2

You have to route the input by priority or z-order. First check HUD or GUI elements (on top) and the actual world ground at last (beneath). If a valid touch target is found/hit then you have to consume the input ond not routing it any further. Think of it as layers, for example [Touch] -> [Button] -> [Character] -> [Ground] Every touch will at ...


0

Look in Mac OS X: ~/Library/Preferences/Unity/WebPlayerPrefs or Windows: %APPDATA%\Unity\WebPlayerPrefs if your save file actually is there and valid.


-1

If I'm reading this correctly, I think all you need to do is remove the Sprite Renderer component(s) from the GameObject in question. Or -- what if you had a Sprite whose Alpha value was 0? Would that work?


1

Yes, this is possible. Many push notification plugins will execute a callback inside your game if a notification is received while the game is running. Inside this callback you can load your desired scene.


0

It sounds like the problem you're encountering is due to a bug or implementation error in the GCM plugin you're using. If your app throws an error when it recieves a GCM notification while not active, that means that it's having an issue displaying the message correctly. I see that the plugin was recently updated, so perhaps the latest version will solve ...


1

I regularly use RPC like the following: { //Send all the ship components to other clients NetworkViewID viewID = ship.GetComponent<NetworkView>().viewID; foreach(ModuleDefinition module in ship.GetAllModuleDefinitions()) { networkView.RPC ("AddShipModule", RPCMode.Others, viewID, netOwner, ...


0

In case if everybody will be looking for something similar, I have found what I have been looking for in the youtube tutorial made by Stuart Spence "Unity3D - Unity 4.6 UI Objects Created at Runtime". Also the release of Unity 4.6 brought the functionality which I wanted. Hope it'll help somebody.


0

The ViewportRect properties are relative to the screen size. X, Y is a screen relative position to place the bottom-left corner of the camera view, and W, H is how big the camera view should be relative to the screen. When you resize the game view, you are changing the size of the game screen, and the camera bound in the scene view adjust themselves to ...


1

If it's 2D then you can simply use: rigidbody2D.gravityScale = -1;. You tagged the question 2D so this should be all you need to do. To toggle isntead of simply set you can change it to rigidbody2D.gravityScale *= -1; If it's 3D and you want the entire scene to have gravity reversed you can do: Physics.gravity = new Vector3(0, -1.0F, 0); If it's 3D and you ...


1

You should try to disable the rigidbody's useGravity property when the collision happens and use AddForce to fake your upwards gravity, pretty much like the example in AddForce documentation.


0

Suppose if you have a curve starting from (0,0) and lands at (100,0). If you only want to draw say 30% of the curve at end, then only draw the segment of curve between x=70 and x=100.


1

The output rate on Android could be locked to 22Khz or depend on the devices. In this case you will have to adjust the mixing rate in software: // foo.wav speed * 8bits of fractions / outputSampleRate int speed = 44100 * 256 / AudioSettings.outputSampleRate; for(int i=0,j=0,max=phonemeBuf.Length * 256; j<max; ++i, j+=speed) if( OFFSET+i < ...


0

Yes. Unity has this functionality built in. Both the legacy GUI system and the new GUI system have scollable containers. Depending on how you show the containers, they can both achieve the functionality you're after.


1

I think you and the commenters are on the right track. Ideally the hitboxes wouldn't have to be recreated on each attack (unless the nature of the attack were to change, maybe?). You could add something like this to every GameObject that can attack, along with a hitbox Collider marked as a Trigger. public class HitController : MonoBehavior { private Queue ...



Top 50 recent answers are included