unity3d

Cannot read value of type 'float' from control

让人想犯罪 __ 提交于 2021-01-29 22:14:28
问题 I'm trying to map my Dual Shock 4 controller with the new input system, but I'm getting this error: InvalidOperationException: Cannot read value of type 'float' from control '/DualShock4GamepadHID/leftStick' bound to action 'Gameplay/Movement[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d,/DualShock4GamepadHID/leftStick,/DualShock4GamepadHID/leftStick,/DualShock4GamepadHID/leftStick,/DualShock4GamepadHID/leftStick]' (control is a 'StickControl' with value type 'Vector2') UnityEngine

How do I properly reload a Unity Scene that uses MRTK for the Hololens2?

心已入冬 提交于 2021-01-29 21:54:39
问题 This is my first project using the Hololens and MRTK for Unity. I want to make a button that restarts the experience for the player when pushed. I connected a button to a new script with the following code: SceneManager.LoadScene(SceneManager.GetActiveScene().name); When the button is pushed the scene seems to reload, but all MRTK/Hololens functionality stops. The hand and eye-tracking are unresponsive, and I am unable to interact with holograms. I know I can manually make a reset method that

Cannot read value of type 'float' from control

蹲街弑〆低调 提交于 2021-01-29 21:35:19
问题 I'm trying to map my Dual Shock 4 controller with the new input system, but I'm getting this error: InvalidOperationException: Cannot read value of type 'float' from control '/DualShock4GamepadHID/leftStick' bound to action 'Gameplay/Movement[/Keyboard/w,/Keyboard/s,/Keyboard/a,/Keyboard/d,/DualShock4GamepadHID/leftStick,/DualShock4GamepadHID/leftStick,/DualShock4GamepadHID/leftStick,/DualShock4GamepadHID/leftStick]' (control is a 'StickControl' with value type 'Vector2') UnityEngine

Joint rotation using Unity Kinect v2 SDK

一个人想着一个人 提交于 2021-01-29 19:53:52
问题 I am trying to make my 3d humanoid model follow the movements i do in front of my kinect v2, i used this in my script and applied it to every part of my model(hands,legs,shoulders...) changing each time the TrackedJoint to the one that matches: var tarx = body.JointOrientations[TrackedJoint].Orientation.X; var tary = body.JointOrientations[TrackedJoint].Orientation.Y; var tarz = body.JointOrientations[TrackedJoint].Orientation.Z; var tarw = body.JointOrientations[TrackedJoint].Orientation.W;

Make an object collide with certain other objects when moved to RaycastHit point in Unity3D?

人走茶凉 提交于 2021-01-29 19:33:59
问题 I'm making a simple building system using Raycasting from the mouse pointer. The object that is to be placed is moved (and cloned on click) to the RaycastHit.point of the ray, but I want it to fully collide with objects of its own type, shifting its position relative to the hit point. The object can intersect the terrain as shown in the gif, but should not be inside of the already placed wall blocks. I tried using hit.distance but couldn't figure the detection out, since the object is being

Raise event c# gives error: No overload matches delegate EventHandler

时光总嘲笑我的痴心妄想 提交于 2021-01-29 19:04:13
问题 I am trying to make an event that gets raised when something happens. So other classes that contain a reference to the class that raised the event get notified. This is what i have got so far: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class DropArea : MonoBehaviour { public event EventHandler ObjectChange; void Start () { } // Update is called once per frame void Update () { } void OnTriggerEnter(Collider other) { var correctType =

MRTK - Maximum number of 64 colliders found in PokePointer overlap query

早过忘川 提交于 2021-01-29 18:18:37
问题 I am trying to build a color selection list in my personal project, with 48 * PressableButtonHoloLens2 + GridObjectCollection . When I run and hover with the simulated fingertip, the editor gives me these warning messages. Q1 : Is this because too many buttons are too close to each other? Or just the number of the buttons with collider is over 64? The message says 'Consider increasing the query buffer size in the pointer profile' Q2 : Where can I increase the buffer size? I don't see any

How to change texture format from Alpha8 to RGBA in Unity3d?

☆樱花仙子☆ 提交于 2021-01-29 17:47:06
问题 I have been trying to change the format from a camera that give a texture in Alpha8 to RGBA and have been unsuccessful so far. This is the code I've tried: public static class TextureHelperClass { public static Texture2D ChangeFormat(this Texture2D oldTexture, TextureFormat newFormat) { //Create new empty Texture Texture2D newTex = new Texture2D(2, 2, newFormat, false); //Copy old texture pixels into new one newTex.SetPixels(oldTexture.GetPixels()); //Apply newTex.Apply(); return newTex; } }

How to draw line smooth in unity (c# base coding problem)

末鹿安然 提交于 2021-01-29 17:23:51
问题 I want to draw line from unityUI. (i dont want to use Line Renderer in unity). So I figured out the coding below, but my problem is the line sizes are not constant. public class MyUILineRenderer : Graphic { public Vector2[] pointPos; public float[] angles; public MyUIGridRenderer gridRenderer; public Vector2Int gridSize = new Vector2Int(1, 1); public float lineThickness = 0.5f; public float width; public float height; public float unitWidth; public float unitHeight; public float angleHelp;

Transferring Excel Data to Unity

回眸只為那壹抹淺笑 提交于 2021-01-29 16:40:10
问题 I have a large list of data in an excel spreadsheet that I need to transfer a few arrays in my Unity project. I have been looking up a few methods and will likely try out a few of them, but I had another question. Is it possible to transfer Excel data to Unity arrays without an additional plug in or tool? Just with base Unity? 回答1: As @julienkay says, if the excel file is a .csv could be treated as a plain text file, BUT what if not? If you are working with .xlsx I recommend to use Microsoft