The Exiled http://theexiled.pwnageservers.com/forum/ |
|
Using a camera to check deploy area http://theexiled.pwnageservers.com/forum/viewtopic.php?f=4&t=1536 |
Page 1 of 1 |
Author: | TE-Noxwizard [ Tue Sep 05, 2006 7:08 pm ] | ||||||||||||
Post subject: | Using a camera to check deploy area | ||||||||||||
This function checks the deploy area when you use it in a deployable item. It spawns a camera at your desired deployment height, then rotates 360 degrees and checks for objects in the way. If you have an object that decends, you can use the %vert to define how high you want to look striaght up above the deployment area.
Code Explaination: This creates a camera at the player's position at the height defined:
This has the camera look straight up for your defined height:
Put that into an if statement and we can check if there's an object in the camera's line-of-sight. If there's something in the way, we'll get it's name and tell the client that it's in the way, and how high up it is. Unless it's terrain.
Now this part's a bit different. We want it to look all the way around, so we will have it look in a lot of directions, by adding 0.1, looking, adding another 0.1, looking, and so on. To do that we use a for loop. We went it to look all the way around, which will be from 0 to 6.28. It's 6.28, because that's just the way circles are handled, instead of degrees it's radians, 6.28 is the same as 360 degrees.
So, if there's something in the way, it reports a false value, which will immediately stop checking. If it makes it through all those checks without seeing an object, it will report a true. To use this, put this in your deployment code:
What that does is checks the area you've defined. So this spawns a camera up 95 meters above you, then looks up 20 meters, then looks around in a 20 meter radius. If it doesn't find anything, it'll go onto the next items in the deploy code. If it does find something, it will halt the deployment. |
Author: | TE-Hammy [ Wed Sep 06, 2006 2:36 pm ] |
Post subject: | |
uhh... GO NOX! woo! |
Author: | TE-4ev3r [ Wed Sep 06, 2006 6:30 pm ] |
Post subject: | |
So, this basically checks the item area limit, and will negate the Item in Way thing if nothing is spotted? |
Author: | TE-Noxwizard [ Wed Sep 06, 2006 9:09 pm ] |
Post subject: | |
Think of it like sonar. The camera makes a circle, if a blip shows up, it stops the deployment. I might add a container box fill, which will create a box with given dimensions and detect objects in it. I will still need the camera since the container doesn't detect terrain. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |