Quantcast
Channel: Latest Questions by Polak149

My character fly up very slow.

$
0
0
I modified code, that allows first person controler to fly. Everything is working fine, but... for some reason, my character fly up slower than goes down. My code below. Any idea? var speed = 6.0; function FixedUpdate() { var cam = transform.Find("Main Camera").gameObject.GetComponent(Camera); var moveDirection = cam.main.transform.TransformDirection (Vector3.forward); Debug.Log(moveDirection.x); moveDirection.z =Input.GetAxis("Vertical")*speed; moveDirection.x =Input.GetAxis("Horizontal")*speed; moveDirection.y *=Input.GetAxis("Vertical")*speed; moveDirection = transform.TransformDirection(moveDirection); Debug.Log(moveDirection); var controller : CharacterController = GetComponent(CharacterController); var flags = controller.Move(moveDirection * Time.deltaTime); } @script RequireComponent(CharacterController)

Body fell of through terrain

$
0
0
Hi! I have rigged body attached to my FPS camera, so player can see his character body, but it seems, that only camera is colliding with terrain. I was trying to add rigidbody component to my body, hoping that will help, but it didnt. Any solutions?

Small objects colliding problem ("sink" in terrain).

$
0
0
I'm making simulation for my three wheeled robot, and i need to keep original size. My robot have diameter 15 cm and mass around 0.2. When i hit "play", i've got this effect: ![alt text][1] [1]: /storage/temp/33436-robot.png My object is not falling through terrain, but it sinks a few cm, and because that, the wheel colliders are not working properly. I know i could rescale the whole world, but i rather would like to avoid that. Is any way to edit terrain or some option in Unity, to make colliding more precise?

Wiki transparent terrain shader is to much transparent.

$
0
0
I'm making a cave in my game, so i tried to use transparent shader avaible on [http://wiki.unity3d.com/index.php/TerrainTransparency][1], but it is appear, that this shader is too much transparent! ![alt text][2] I can't see the rest of the cave, but only the fog, as if there is nothing behind the terrain. How can I fix this, so i can actually see the rest of my cave? [1]: http://wiki.unity3d.com/index.php/TerrainTransparency [2]: /storage/temp/34764-stack.png

Coroutine with long loop in edit mode script

$
0
0
I am preparing own mesh generator in Unity and i need to see status of long loop. Basically I have the for loop in @ExecuteInEditMode() script and i need to write from time to time in the console information about loop index value. Yield is not working, cause it is script in Edit Mode. I tried also with @CustomEditor and EditorUtility.SetDirty(target) method but it is to slow. Is there other option to achieve what i need?

Procedural mesh generation - problem with normals.

$
0
0
I'm trying to make mesh figure generated procedurally but some triangles clearly have broken normals. What is weird, everything is okay during play in editor: ![alt text][1] But after build game and run it from exe file,has become a strange light on some triangles. ![alt text][2] On pictures we have exactly same place, but we can see, that some triangles on lava mesh ignore light. My mesh needs to have normal maps. It of course require tangents so to achieve that, I'm using script avaible at http://www.terathon.com/code/tangent.html and converted to javascript by nootz (http://forum.unity3d.com/threads/how-to-calculate-mesh-tangents.38984/): /* Derived from Lengyel, Eric. “Computing Tangent Space Basis Vectors for an Arbitrary Mesh”. Terathon Software 3D Graphics Library, 2001. http://www.terathon.com/code/tangent.html */ static function TangentSolver(theMesh : Mesh) { vertexCount = theMesh.vertexCount; vertices = theMesh.vertices; normals = theMesh.normals; texcoords = theMesh.uv; triangles = theMesh.triangles; triangleCount = triangles.length/3; tangents = new Vector4[vertexCount]; tan1 = new Vector3[vertexCount]; tan2 = new Vector3[vertexCount]; tri = 0; for ( i = 0; i

Animation Component do not refresh after change in inspector

$
0
0
I have noticed, that when I add new animation clip or change one at existing index in Animation component, data are not changed until Unity reset or Scene Play. I'm creating extension to Unity Editor and I need to get current list of animations clip in Animation, but when I do it after changes on Animation (adding or switching clips), i gets old, unchanged list. I'm getting list using for loop; animationsScript = target as Animations; //Animations is a js script var animations : SerializedProperty; //String //OnEnable() animationsScript = target as Animations; animations = serializedObject.FindProperty("animations"); // OnInspectorGUI() var count : int; for(var animationState: AnimationState in animationsScript.GetComponent(Animation)) { animations.GetArrayElementAtIndex(count).stringValue = animationState.clip.name; count++; } Is there a method that allow to manually update changes in component inspector or something like that?

Compile priority - accessing static variables

$
0
0
I'm writing some editor extension to Asset Store, that will generate you pretty lava environment. This lava environment is scripted, so it will interact with objects. One of the scripts (normal, no-editor script written in javascript), called LavaTrigger.js have some static variables, so they can be used by other scripts: static var PlayerInLava : boolean; // info if player is in lava static var lavaDeath : boolean; // info if player died in lava static var lavaHeight : float; // lava mesh height at player position static var lavaTransform : Transform; // used to determine lava transform, for other scripts But! Unity Assets require to put content in the main Assets folder. Referencing to this link http://docs.unity3d.com/Documentation/Manual/ScriptCompileOrderFolders.html scripts in Asset folder are compiled in phase 4. Scripts in Standard Assets are compiled in phase 1. Loot of users are creating their own scripts in Standard Assets, so any try to use those static variables (by script in Standard Assets) from script in Assets folder: if (LavaTrigger.lavaDeath) { //do something } ... will end with failure: BCE0005: Unknown identifier: 'LavaTrigger' So, my question is: Do i have to tell every user, that he have to move my LavaTrigger.js to Standard Assets, or there is nice solution to my problem?

Unity 5.0 and alternative for triggering complex meshes.

$
0
0
Now, when physX 3.3 is up, non-convex mesh cannot be a trigger. It gives me a headache, because half of my game was based on large mesh surface, that was a trigger. Convex mesh cannot have more triangles than 255. I tried to split my mesh to smaller parts (that already have only 255 triangles), but even then, pressing "convex" tick is just breaking my splitted mesh. I have a almost flat surface and i don't think, that ![alt text][1] Is there now possibility to create large, static mesh, that will act like trigger? I need to know if any scene object touch my surface (like OnTriggerEnter) and objects have to be able to pass through surface (like after pressed isTrigger in collider component!). I cannot use raycasts, because objects, that can touch surface can be hundreds. Building collider from primitives also cannot be used, because my surface is generated procedurally. It can change shapes every game. [1]: /storage/temp/41984-stack.jpg

Error: "chanType.dimension == 0"

$
0
0
I'm getting wierd error: chanType.dimension == 0 UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String) UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean) I can't determine from where it comes from and what causes it. It only shows once, after Unity launch and after that only first line, chanType.dimension == 0, keeps shownig when hit game play. As error says, something with my custome editor window is wrong, but before unity 5, everything was fine. Project rebuild did not help. Any idea what is that? UPDATE: I have discovered that cause of this error is Particle System component. When I removed it, error was no longer present. UPDATE: Just noticed, that error start shows up, when in Particle System i choice Mesh Shape. I have procedurally generated, almost flat surface. Everything works fine. Particle is generated over whole mesh. Just this error.

Error: "chanType.dimension == 0"

$
0
0
I'm getting wierd error: chanType.dimension == 0 UnityEditorInternal.InternalEditorUtility:LoadSerializedFileAndForget(String) UnityEditor.WindowLayout:LoadWindowLayout(String, Boolean) I have discovered that cause of this error is Particle System component. Error start shows up, when in Particle System i choice my procedurally generated Mesh Shape. It's almost flat surface, for sure it cannot be name as convex. Except that error, Everything works fine. Particle is generated over whole mesh. Just this error... How i can get rid of it

Controller's data are not correct

$
0
0
I have a controller, gyroscope that return's X and Y. Windows see this controller as correct HID device and even in it's configuration window, shows correct position ( Vector2(0,0) at gyroscope center). ![alt text][1] Unity also see this device as joystick using functions Input.GetAxis("HorizontalBoard") and Input.GetAxis("VerticalBoard") i can read my gyroscope X and Y... but they are different than in windows configurator. In Unity my gyroscope center is at Vector2(-1,-1) position, which should by achieved at max gyro swing and Vector2(0,0) position is present at half of the way to gyro max swing. It's looks like center in Unity is shifted by half of max swing.This is my configuration of this device in InputManager: ![alt text][2] My questions are: 1. If Windows device configuration shows correct position, why in Unity it is different? 2. In Unity, does Input axis can be configured to offset value? [1]: /storage/temp/47838-answer-pic1.png [2]: /storage/temp/47840-answer-pic2.png

Horizontal Layout Group padding update via script

$
0
0
I have UI DropDown combo box, constructed from layout groups, buttons and panels and i want to animate combobox elements (that basically are buttons placed in Layout Group) hide and show act. Idea was to change their anchored position by Layout Group padding (since i can't change position by rectTransform) and during test (that means changing padding value in inspector), everything went find, but when i tried to change padding value via script, although value HAS changed in inspector, RectTransform didn't changed. Any change on inspector, and recTransform update to value passed by script. I did some tests with simple script: public HorizontalLayoutGroup sterringLayout; void Update() { sterringLayout.padding.top += 1; } In inspector values of sterringLayout padding gone crazy, but RectTransform did not change. What is cause of that? Is there workaround?




Latest Images