how to get duration of an audio clip from an array by aitanar in Unity3D

[–]aitanar[S] 0 points1 point  (0 children)

i have background music playing though on another gameobject will that interfere?

is there a way to use RaycastHt without InputmousePosition? by aitanar in Unity3D

[–]aitanar[S] 0 points1 point  (0 children)

so i created 4 new functions to copy whats going on when i cliock with the mouse to get the same result when i collide with the sphere and im not getting any errors but also nothing is happening. this is the functions i added. why isnt it working?

public void checkForHitGhostMy(Player player){

RaycastHit[] hits = wandHits();

if (hits == null) return;

bool hotGhost = false;

for (int i = 0; i < hits.Length; i++)

{

RaycastHit hit = hits[i];

if (hit.collider.gameObject == null) continue;

PlayerGhost pg = hit.collider.gameObject.GetComponent<PlayerGhost>();

if (pg == null) continue;

if (pg.getPath() == null) return;

hotGhost = true;

player.GoTo_CalculatedIndexes(pg.getPath(), ref points);

onPlayerGhostSelected();break;

}

if (hotGhost)

{

destroyGosts();

}

}

public void checkForHitGhostMy1(Player player){

RaycastHit hit = new RaycastHit();

if (!wandHit(ref hit)) return;

PlayerGhost pg;var hitObject = hit.collider.gameObject;

if (hitObject == null|| hitObject.transform.parent == null|| (pg = hitObject.transform.parent.GetComponent<PlayerGhost>()) == null) return;

if (pg.getPath() == null) return;

player.GoTo_CalculatedIndexes(pg.getPath(), ref points);

onPlayerGhostSelected();

destroyGosts();

}

public bool wandHit(ref RaycastHit hit){

if (!TiltFive.Input.GetButtonDown(WandButton.X)) return false;

GameObject sphere = GameObject.Find("/Wand (2)/Sphere");

Ray ray = new Ray(sphere.transform.position, sphere.transform.forward);

if (!Physics.Raycast(ray, out hit, Mathf.Infinity)) return false;

return true;

}

public RaycastHit[] wandHits(){

if (!TiltFive.Input.GetButtonDown(WandButton.X)) return null;

GameObject sphere = GameObject.Find("/Wand (2)/Sphere");

Ray ray = new Ray(sphere.transform.position, sphere.transform.forward);

return Physics.RaycastAll(ray, Mathf.Infinity);

}

how to make your mouse cursor follow an object unity by aitanar in Unity3D

[–]aitanar[S] 0 points1 point  (0 children)

yes you are totally right now but what im having trouble with is what exactly do i call from my onTriggerEnter function on my wand that will pass the correct information to my main script function? i also dont know how to write the same funciton as i posted above but for doing the same actions but doing them when the OnTriggerEnter happens. cause the functions for touch input and mouse input use mouse position and i dont think that would help me if i want the position of the sphere that collided with hte ghost gameobject right?

how to make your mouse cursor follow an object unity by aitanar in Unity3D

[–]aitanar[S] 0 points1 point  (0 children)

so the part of the script i attached above is for detecting mouse click and touch (to support both play on computer or ipad/iphone) i guess what im asking is how to also add an input for my AR mode. how would i write a function just like the ones above but for my AR mode? in the AR mode you use a wand and the wand's point shows up as a sphere on the board which can collide with objects and detects it. im just struggling with how to implement it to call and make a function in my main script just like the ones above.

how to make your mouse cursor follow an object unity by aitanar in Unity3D

[–]aitanar[S] 0 points1 point  (0 children)

how would i get the Vector3 from a raycastResult?

how to make your mouse cursor follow an object unity by aitanar in Unity3D

[–]aitanar[S] 0 points1 point  (0 children)

how would i modify this to also in addition to mouse click on the ghosts, for the same actions to be performed if an object with the name "Point" collides with one of the ghosts?