Draw af line in a specific angle around an object
Hi. I have a transform which I can draw a Ray from using e.g. Gizmos.DrawRay. My problem is that I don't know how to define an angle instead of a direction. E.g. I can understand that transform.forward...
View ArticleRayCast "blueline" qoes down
Hallo. I want to create FPS. I was finding gun shoot script for 2 days. I found narutoisgreat1234's Raycast shoot script. Here is it with my small modifications. :` var Range : float = 1000; var Force...
View ArticleVector direction to point
How do i convert Debug.DrawRay to LineRenderer? var lineRenderer : LineRenderer = GetComponent(LineRenderer); var aimEnd2 : Vector3; aimEnd2 = (aimStart - currentTouchPos).normalized; Debug.DrawRay...
View ArticleDebug.DrawRay from camera
Hi. I'm fairly new to unity and have been on it for a couple weeks now. So I'm currently trying to draw a ray from my camera to wherever I click. I've got the ray barely working. I see the ray only in...
View ArticleProblem With Physics.Raycast
Hi, I am trying to create a Ray from my MainCamera to my Player Here is the code I used... -------- var target : Transform; function Update () { Debug.DrawRay(transform.position, target.position); if...
View ArticleRotate From SpawnPoint TO Transform Rotation
Hello Everyone i Got Problem With Shooting Bullet its shoot from the spawnPoint [Weapon] To Forward i actually need it to shoot from SpawnPoint To Forward but with rotate Lemme Show You This Photo,...
View ArticleLayerMask, DrawRay and DrawLine acting weird...
Ok, so I am getting some odd results when I use Physics.DrawRay(). I have created a function for detecting collisions with other game objects on Layer 10. Unfortunately, while the ray passes through...
View ArticleRaycast doesn't work properly?
So my camera throws a Raycast forward, and if this raycasts target hits a specified target, i want it to tell me. Very simple. Altough, it doesn't seem to always tell me when the target gets hit even...
View ArticleDrawRay with a custom class.
I have 2 simple scripts witch have to dray a ray from an objects position upwards but it dosent do anything, --the class witch draws the ray #pragma strict class aClass { var pos : Transform; function...
View ArticleRaycast won't hit Collider
I trying to build a point and click system where the point i click will become destination point for the NavMeshAgent. Here is the code i am using: if (Input.GetKey (KeyCode.Mouse0)) { ray =...
View ArticleHow to calculate Debug.DrawRay length to match raycast
Hi everyone, I've come across a bit of a problem. I am trying to work with some rays however when I tried to add a visual element to it I noticed something was wrong. I realize that you assign a length...
View ArticleWhy doesn't the distance in RaycastAll and DrawRay correspond?
Hi! My problem is that the length/distance of the ray drawn is not the same as the ray being cast, even though the numbers are the same. The ray is only as long as about 2/3 of the ray that is shown....
View Articlemaking Debug.DrawRay infinitely long using Mathf.Infinity
void Update () { Debug.DrawRay (transform.parent.position,transform.parent.forward*Mathf.Infinity); } I have this code, and the ray does not display in the editor. However, when I use the code below,...
View ArticleWhat does direction do for a physics.raycast besides direction? (read details)
When you use Debug.Drawray it's direction parameter also sets the ray's length (like writing Vector3.forward * 10). Physics.raycast has a separate ray length setting, but what does multiplying it's...
View ArticleRaycast from transform.position to Player.transform.position is not...
I did Debug.DrawRay (transform.position, PlayerGet.transform.position);
View ArticleHow can I draw a specific distance with Debug.Drawray
I have this issue: I'm using Physics2D.Raycast as next: RaycastHit2D hit_der = Physics2D.Raycast (transform.position+new Vector3(transform.localScale.x/2,0,0),Vector3.right,1,10); RaycastHit2D hit_izq...
View ArticleHow to make Debug.Drawray visible in game?
Hello. Is there any way to to make the Debug.DrawRay function visible in-game and not just in the editor? Or what alternatives are there to the debug.drawray function? This is the code i'm using and...
View ArticleAdd layermask to DrawLine & DrawRay or something similar with visible Ray
I want to test my Ray but like all good rays, I need a layermask. Unfortunately, Unity does not add this option for their debugs for RayCast, DrawLine & DrawRay. How can I find a work around for...
View ArticleDrawRay Hits but RayCast does not
Hello, I have this script which should create a raycast and print the exact line of the raycast. Debug.DrawRay(this.transform.position, new Vector3 (1, 1, 0)*7,Color.red,3.0f); RaycastHit2D hit =...
View ArticleCall an exorcist.
Whenever I start up my game and move the camera my character gets possessed and break dances (I can't get a clear screen shot of it but the orange lines are a drawray from my camera so you can probably...
View Article