smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 26 May 2013 03:05 PM |
does anyone else ever have problems with raycasting? I'm working on rewriting my pathfinder and the code works fine but for whatever reason I'll have rays that randomly ignore walls clearly in front of their path. Here's the raycasting code
local collision, p = getHit(Workspace, ray(n.pos, vec))
n.pos being the old node's position vec being one of the given vectors {(amount, 0, 0), (-amount, 0, 0), (0, 0, amount), (0, 0, -amount)}
I really don't get it because there's no visible pattern and it only occurs @1-3 walls(in a randomly generated maze). Now I don't need help with my code or anything, I'm just wondering if anyone else has had this problem and if there's any known solutions? |
|
|
| Report Abuse |
|
|
|
| 26 May 2013 03:07 PM |
What's getHit()? Why is Workspace the first parameter?
The Prime Jester of Scripters has spoken. |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 26 May 2013 03:08 PM |
| Oh and getHit == Workspace.FindPartOnRay |
|
|
| Report Abuse |
|
|
|
| 26 May 2013 03:13 PM |
| How do you expect us to tell you why your code won't work with your context when you aren't giving us any context? |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 26 May 2013 03:15 PM |
| did you really just ask that... |
|
|
| Report Abuse |
|
|
|
| 26 May 2013 03:15 PM |
Hey, are bricks still ignored if they're directly adjacent to a brick that has the ray physically inside it?
The Prime Jester of Scripters has spoken. |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 26 May 2013 03:16 PM |
| Uhh I'm not sure. Nonetheless that's never the case |
|
|
| Report Abuse |
|
|
|
| 26 May 2013 03:18 PM |
Bro, you can't expect meaningful help without a complete and minimal example.
The Prime Jester of Scripters has spoken. |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 26 May 2013 03:44 PM |
That's pretty much as useful as I gets but I uploaded a place. Hit run before you enable the Pathfinder script
http://www.roblox.com/User.aspx?ID=21616642 |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 26 May 2013 03:47 PM |
| Oh and it may take a few tries. Just follow the path and you'll see it randomly move through a wall |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
| |
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 31 May 2013 07:08 PM |
or not. . . The place is still up if anyone wants to see. I updated it a bit but its still the same problem >.> Black rays parts indicate there is a collision(path is not available) red ray parts indicate there is no wall between the nodes(path is available) |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 31 May 2013 09:24 PM |
He seems to of had the same bug -
http://www.roblox.com/Forum/ShowPost.aspx?PostID=81797075 |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 01 Jun 2013 06:27 PM |
Alright I updated the place again and I have a specific example. Just open in studio and type - print(Workspace:FindPartOnRay(Ray.new(Vector3.new(0, 5, -45), Vector3.new(-15, 0, 0)), Workspace.Path))
If you move your camera to that position you'll see a wall between (0, 5, -45) and (-15, 5, -45). |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
| |
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 01 Jun 2013 10:48 PM |
So I tried playing with the ray and got weird results -
-----------------------------------------------------------------
1) I increased the length ray by 200 - no parts registered: print(Workspace:FindPartOnRay(Ray.new(Vector3.new(0, 5, -45), Vector3.new(-200, 0, 0)), Workspace.Path))
2) I moved the ray over 1 stud(x axis) - the part registers: print(Workspace:FindPartOnRay(Ray.new(Vector3.new(1, 5, -45), Vector3.new(-15, 0, 0)), Workspace.Path))
3) I moved the orginal ray over 1 stud(z axis) - no parts register: print(Workspace:FindPartOnRay(Ray.new(Vector3.new(0, 5, -44), Vector3.new(-15, 0, 0)), Workspace.Path))
-----------------------------------------------------------------
Im pretty sure that its an internal bug by this point? also it feels like a bunch of people are looking at this thread and not saying anything >.> do you guys really not care that much or do you just like seeing me post. . . |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
| |
|
|
| 02 Jun 2013 11:35 AM |
There is no such thing as code working sometimes and not other times. When one is thinking this, one obviousely has a logic error in the code.
"Draw" the ray everytime u fire one and u will find the problem.....
Or take Speed AI. Uses Ray-casting to get out of a maze. Set GraphicsON to true to see the rays.......
GL, Brian
|
|
|
| Report Abuse |
|
|
|
| 02 Jun 2013 11:48 AM |
lol,
Yeah, read the other thread. U guys are wac. Just because your graphics went through a wall, doesn't mean that the ray did.
It means your DrawRay code has a bug, and is not drawing in the right place.
After hours and months of testing AIs, a ray has never missed, and never will.
Remember that a Ray is a ray. It has zero thickness. Your graphic of a ray must have some thickness to show-up, so may "appear" to clip a wall....... |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 02 Jun 2013 02:11 PM |
"There is no such thing as code working sometimes and not other times. When one is thinking this, one obviousely has a logic error in the code.
"Draw" the ray everytime u fire one and u will find the problem..... "
Idk if you visited the place or not, its an example from my path finder and I drew a ray between every node. The ray goes right through the middle of the wall, so its obviously not a problem with the visual ray 'clipping' the wall. Its a direct collision that's not registering
http://www.roblox.com/User.aspx?ID=21616642 Run this in the command bar - print(Workspace:FindPartOnRay(Ray.new(Vector3.new(0, 5, -45), Vector3.new(-15, 0, 0)), Workspace.Path))
If you set your camera to that position(I think its already there when you open in studio?) it goes right through the wall as if it was nothing |
|
|
| Report Abuse |
|
|