unity3d

Why do Quaternions have four variables?

非 Y 不嫁゛ 提交于 2021-01-27 13:55:33
问题 The official documentation for the Unity Engine doesn't contain this, and I'm not far enough into my math/physics studies to have come across a Quaternion, but I understand it has to do with rotation. What I don't understand is why Quaternions have four variables, w,x,y,z, when there are only three axis of rotation in Unity. 回答1: "A quaternion is basically an axis in 3D space with a angle of rotation around the axis. Four values make up a quaternion, namely x, y, z and w. Three of the values

Get Length of Trail Renderer

让人想犯罪 __ 提交于 2021-01-27 13:44:37
问题 How do I get the length of the whole Trail renderer that is drawn in Unity? For line renderer, we can achieve this using the 1st and 2nd points of the line such as: var length = (position2 - position1).magnitude; But unfortunately I could not find the same for trail renderer since it uses multiple points. So how do I achieve this? 回答1: You can iterate through all points using TrailRenderer.GetPositions like e.g. public static class TrailRendererExtensions { public static float GetTrailLength

How do I fill white space on screen web gl unity?

爱⌒轻易说出口 提交于 2021-01-27 13:32:01
问题 whitespace image hardcoded image so this game we are making i want the game screen to fill up the white space (i think this is called making it the native resolution ?). the coder says "the container is just hardcoded to a certain size" and he doesn't know how to make it fill up the screen pefectly consistently for all computers for example if computers have different resolutions. the game is being made in unity and the guy said its in web gl. sorry and thank you, new to this site. 回答1: You

Move object relative to a point it is always facing causes spiraling orbit

混江龙づ霸主 提交于 2021-01-27 11:52:44
问题 I'm developing a simulation where player should be able to move around inside a 2D circle (referred to as sphere in my code). The players movement must be relative to the center of the circle. My first step was to make sure the player always faces the center. I got the working fine. However when I tried to do the relative movement it doesn't give my quite the result I'm looking for. When I move the player close to the center of circle and move sideways (which is relative to the player's

Unity: VRDevice cardboard not supported in Editor Mode. Please run on target device

社会主义新天地 提交于 2021-01-27 09:34:34
问题 There is a problem that the screen can not be divided during the card board test. I'm use versions for goolge sdk for unity 1.6 and Unity 5.6.2f1. in emulater(unity game scene),Game Scene does not split when playing. and console display "VRDevice cardboard not supported in Editor Mode. Please run on target device." but, Screen is split when testing on phone. What's the problem? 回答1: Google VR SDK for Unity v1.50 (May 2017) or above have removed support for stereo preview in the unity editor.

Unity: VRDevice cardboard not supported in Editor Mode. Please run on target device

寵の児 提交于 2021-01-27 09:33:32
问题 There is a problem that the screen can not be divided during the card board test. I'm use versions for goolge sdk for unity 1.6 and Unity 5.6.2f1. in emulater(unity game scene),Game Scene does not split when playing. and console display "VRDevice cardboard not supported in Editor Mode. Please run on target device." but, Screen is split when testing on phone. What's the problem? 回答1: Google VR SDK for Unity v1.50 (May 2017) or above have removed support for stereo preview in the unity editor.

Unity mobile device 30fps locked

笑着哭i 提交于 2021-01-27 07:11:05
问题 Since yesterday, my unity game is locked 30fps on an android device. Before it was like 150fps.. I disabled v-sync. This is the only script I added yesterday: public static class SaveLoadProgress { public static void Save() { LevelManager levelManager = GameObject.Find ("GameManager").GetComponent<LevelManager> (); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create (Application.persistentDataPath + "/savedProgress.1912"); bf.Serialize(file, levelManager.levelReached);

C# weighted random numbers

霸气de小男生 提交于 2021-01-27 06:37:58
问题 I need help with the programming of a game. You open a chest and with a given probability you find an item. Item / Chance A / 10% B / 30% C / 60% Random random = new Random(); int x = random.Next(1, 101); if (x < 11) // Numbers 1..10 ( A -> 10% ) { do_something1(); d } else if (x < 41) // Numbers 11..40 ( B -> 30 % ) { do_something2(); } else if (x < 101) // Numbers 41..100 ( C -> 60 % ) { do_something3(); } Does this example really make sense, in terms of probability? Do you have another

C# weighted random numbers

给你一囗甜甜゛ 提交于 2021-01-27 06:36:14
问题 I need help with the programming of a game. You open a chest and with a given probability you find an item. Item / Chance A / 10% B / 30% C / 60% Random random = new Random(); int x = random.Next(1, 101); if (x < 11) // Numbers 1..10 ( A -> 10% ) { do_something1(); d } else if (x < 41) // Numbers 11..40 ( B -> 30 % ) { do_something2(); } else if (x < 101) // Numbers 41..100 ( C -> 60 % ) { do_something3(); } Does this example really make sense, in terms of probability? Do you have another

Unity 2019.3.0a7: Microsoft Visual C# Compiler Errors

非 Y 不嫁゛ 提交于 2021-01-27 05:31:38
问题 I've upgrade to the most recent Unity build (Unity 2019.3.0a7) and I'm getting a ton of errors, all the same, across different files. My friends who I'm collaborating with are also running the same version, but don't have the errors. There are two of them, each referencing different packages, but both referencing multiple errors inside each of the packages. The errors are along the lines of: (R) Visual C# Compiler version 2.9.1.65535 (9d34608e) Copyright (C) Microsoft Corporation. All rights