Raycasting / Receiving problem
Hi everyone !
I'm making a VR app with objects supposed to react to events like doors or TV.
So my problem is that my ray is not detected good enough( Often have to be near to the object in order to the object react(in my case , this is to change from red color to green.
Note that i've a Player : ThirdPersoncontroller child --> Main Camera child -->CadrBoardAdapter child -->Left an Right Camera
On the right camera i'va putted my Component Physics Raycaster What's surprising ? So, when i put the raycaster on ThirdPersonController, my objects can see the ray from more away than i it was place on Right Camera. Someone have an idea ?
there is my codes :
This code is attached on an object i want to change color when touched by a raycast
[RequireComponent(typeof(Collider))] public class Teleport : MonoBehaviour { private Vector3 startingPosition;
void Start() {
startingPosition = transform.localPosition; SetGazedAt(false); }
public void SetGazedAt(bool gazedAt) {
GetComponent().material.color = gazedAt ? Color.green : Color.red;
}
/public void Reset() { transform.localPosition = startingPosition; }/
public void ToggleVRMode() {
Cardboard.SDK.VRModeEnabled = !Cardboard.SDK.VRModeEnabled; } }
Your answer
Follow this Question
Related Questions
Trouble Raycasting elements in UI in Oculus 0 Answers
How do i snap the end point of a Raycast to a certain transform 1 Answer
raycast activation by trigger 0 Answers
SteamVR and canvas interaction? 2 Answers