unity3d

How to change object's pivot point using C# in Unity?

做~自己de王妃 提交于 2021-01-29 16:11:42
问题 I am trying to change the Pivot Point of an object in Unity 3D using C#. I am aware of editing the object in a design software beforehand to desired point but, in my specific situation, the Pivot Point needs to be changed while game in running. Here is the code I am using to rotate the object from its left side: verticalInputLeft = Input.GetAxis("VerticalLeft"); rotationLeftX += verticalInputLeft * verticalSensitivity * Time.deltaTime; rotationLeftX = Mathf.Clamp(rotationLeftX, minAngle,

Minimum players to enter in a room PHOTON

非 Y 不嫁゛ 提交于 2021-01-29 14:30:25
问题 I am doing a multiplayer game and I want to know how I can add a minimum number of players for a user to enter a room . Like to not be alone till one player is connected at least. What I should add to my script? I have this Room Options function but It doesn't work too add like Min players or something to it. (I expected if is MaxPlayers to exist MinPlayers too) using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon; using Photon.Pun; using UnityEngine.UI;

Unity3D: Speed up highscore count up

夙愿已清 提交于 2021-01-29 11:23:38
问题 I have a integer that holds the player's highscore and it is shown when the player dies in my game over panel. When the player gets a new highscore, I created a function to increase the int to make a cool highscore count up effect; it works, however it is not as fast as I'd hope it to be, especially if the player were to get a very high highscore, like for example : 400. Is there a way to make my highscore count up function much faster? This is my code: public int i; public Text highScore;

Find an angle to launch the projectile at to reach a specific point

ぐ巨炮叔叔 提交于 2021-01-29 10:32:15
问题 So, Dani in his slightly new video -> "Making a Game, But I Only Have 3 Days" (https://youtu.be/S7Dl6ATRK2M) made a enemy which has a bow and arrow (at 5:39). I tried to recreate that but had no luck... I also can't find the website that he used... Today I found this https://physics.stackexchange.com/questions/56265/how-to-get-the-angle-needed-for-a-projectile-to-pass-through-a-given-point-for-t. It worked very well but still had problems if the target was far away and also it wasn't as

Using OneDrive filePicker to access data

北城余情 提交于 2021-01-29 10:24:12
问题 I'm trying to develop a Unity application on Hololens which needs to instantiate some 3D models at runtime. I was thinking of using OneDrive to store unity AssetBundle and load when I need, simply using the local path. The problem that I'm facing is that Hololens has a different file system structure and UWP application can access only certain directories. I've read Trouble with FilePickers in Unity Hololens development, Filepicker for Hololens: List available filepickers? and App to app

Unity3D - Post is empty when doing a UnityWebRequest

随声附和 提交于 2021-01-29 08:37:26
问题 I'm doing a UnityWebrequest and it's working fine, but upon checking what's is the post in my PHP I found that the post is an empty array and the file is aswell. I found a StackOverflow post that has a similar problem. But it's solution did not work for me. So why is the post and file empty? I'm running this on a local server. UnityWebRequest POST to PHP not work Web request static IEnumerator Post(string url, string bodyJsonString) { UnityWebRequest request = new UnityWebRequest(url, "POST")

How to keep Hololens holograms anchored in physical environment?

末鹿安然 提交于 2021-01-29 08:27:42
问题 As noted here, the documentation on this topic seems very limited. I know that I need a "World Anchor". I am having problems finding any documentation on how to use such an anchor. This is the closest documentation I can find from Microsoft, but leaves out a lot of details and doesn't have any working examples. The documentation from Unity isn't much better, although it addresses WorldAnchor specifically. I started by simply adding a component to the GameObject via the Unity editor, via "Add

How to Lerp a rotation the shortest path

混江龙づ霸主 提交于 2021-01-29 08:22:59
问题 I have a tank, which is made of a base and turret on top, both separate but under a parent object. To shoot, the turret will rotate to the shooting direction, then lerp back towards the tanks base rotation. I want to rotate the turret in the shortest possible direction. So if the base is at 0 degrees and the turret is at 270, I change the 270 to -90 and it will lerp from -90 to 0, however if the base is at 180 and the turret is at 270, it needs to lerp from 270 to 180, not from -90. This is

Need help making a sphere move in parabola as part of a projectile simulator?

社会主义新天地 提交于 2021-01-29 08:17:17
问题 Hi I'm currently working on a school computer science project for which I have decided to make a simple projectile simulator, where the user just provides the initial launch speed, the launch angle, and gravity. So far I've tried to make a script that uses these values to calculate a trajectory pattern and change the y and z position of a sphere across a plane over time. public class SphereJump : MonoBehaviour{ public float gravity = 9.8f; public float InitialSpeed = 10.0f; public float

How to integrate unity game in React native app without WebGL?

不想你离开。 提交于 2021-01-29 07:39:08
问题 I want to build a React Native App with a sub-feature of my Unity Game. Is there any way of integrating Unity Game in RN without WebGL? Or is there any way I can launch the Unity Game App from the RN App? If the WebGL is the only option then, what could be the speed of my TCG Game? How can I improve it? 回答1: In Unity2018.3, they release a new function call Tiny Mode . It support you to build html5 projects with a very small file size and memory footprint. Maybe you can give it a try. Official