New answers tagged

1

Physics.Raycast will help you to get the gameobject using mousePosition and ScreenPointToRay using UnityEngine; using System.Collections; public class Example : MonoBehaviour { Ray ray; RaycastHit hit; void Update() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); if(Physics.Raycast(ray, out hit)) ...


0

The whole setup seems a bit strange. Is the speed always a fixed number, and what you're dealing with now is how to choose direction? Or is the speed dependent on the movement as well? If the latter case (speed dependent on mouse movement): You should either make this "physical", i.e let the delta mouse movement result in acceleration, or link delta ...


0

Yes, it is collision checking. Though, there's a little misunderstanding about variables that I'll first try to clarify before proceeding to a solution to your problem. What does what First of all, image_number is a constant (YoYo Docs call it read-only variable) that gives you the number of sub-images of an object's current sprite (its sprite_index). If ...


2

This is the signature of the function you're trying to use Vector3.Project(Vector3 vector, Vector3 onNormal) you're passing it only 1 parameter. And this is the first problem. The latter is that a Vector3 does not contain a Camera property.


0

How do I know what the camera distance is from the image plane? I'm not sure if this is a meaningful question to ask - what is the image plane? A real camera has a plane on which an image is formed, but in OpenGL there is no such thing. If you need this for some physics-based calculation, you could possibly use the near clipping plane distance (third ...


1

Okay so I have fixed this. Hopefully this answer will help someone else. Okay if you look at this script MouseLook.cs under StandardAssets/Characters/FirstPersonCharacters/Scripts/. Go to lines 83,88,89. Make the following changes : m_cursorIsLocked = true;(line 83) change to 'false' Cursor.lockState = CursorLockMode.Locked; (line 88) change to 'none' ...



Top 50 recent answers are included