Wall or object between two points
Moderator: Core Staff
Wall or object between two points
Is it possible to check if there is a wall or an other object between two points?
Re: Wall or object between two points
I have changed my question. I hope someone can and will help me
Re: Wall or object between two points
Sure is possible
Use this code:
Use this code:
Code: Select all
trace=bullettrace(point1,point2,false,undefined);
if(trace["position"]!=point2)
//there is something between the objects
else
//no wall
Re: Wall or object between two points
Thanks
That works perfect
That works perfect
Re: Wall or object between two points
sexier code:
Code: Select all
if (bullettrace(point1,point2,false,undefined)["position"] != point2)
Re: Wall or object between two points
I understand that. But the first one is clearer imo.
Re: Wall or object between two points
ye sure clearer a bit but size wins ^^ coz mine isnt that messed.
Re: Wall or object between two points
megazor wrote:ye sure clearer a bit but size wins ^^ coz mine isnt that messed.
Some credit for FIRST POST!!!!11!!!oneone!!!1 ?
it doesnt really matter which you use, unless you really care for gsc size... (...)
Re: Wall or object between two points
IzNoGoD his method > megazor his method
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Wall or object between two points
I would personally use the first code. It is just simply better practice to use one function at a time, instead of nesting a function inside a function., although both will work just as well as the other.
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Re: Wall or object between two points
my code calls bullettrace function only one time, so for this case mine works at least not slower than the first code
Re: Wall or object between two points
Go put the trace= stuff on the trace position in the if loop. This is what you get:IzNoGoD wrote:Sure is possible
Use this code:Code: Select all
trace=bullettrace(point1,point2,false,undefined); if(trace["position"]!=point2) //there is something between the objects else //no wall
Code: Select all
if(bullettrace(point1,point2,false,undefined)["position"]!=point2)
//wall
else
//no wall
Re: Wall or object between two points
i dont understand. "if loop"? lol
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Wall or object between two points
They are exactly the same code. One is just more aesthetically pleasing than the other.megazor wrote:my code calls bullettrace function only one time, so for this case mine works at least not slower than the first code
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010
Who is online
Users browsing this forum: No registered users and 14 guests