Tag Info

Hot answers tagged

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 * ...


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.


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 ...


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);


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 ...


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 ...


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 ...


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 ...


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 ...


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 ...


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 - ...


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 ...


1

Here is an idea, and I think it'll work: Save a copy of planet mesh vertices CPU side. Having mesh vertices, also means you do have access to normal vectors, for each point on the planet. Then completely disable gravity for all entities, and instead apply a force in exactly opposite direction of normal vector. The next thing you have to consider is to ...


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

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 ...


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 ...


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 ...



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