Author |
Message |
whitty
Joined: Sat Jun 16, 2007 2:31 am Posts: 2982 Location: Texas
|
Terrain proximity MOPixel deletion
This code deletes an MOPixel when close/close enough to terrain. Code: function Update(self) if self:GetAltitude(5,2) < 3 then self.ToDelete = true; end end However. This seems to be completely ineffective when you shoot straight up. I shoot horizontally, my bullets do little/nothing to the terrain. I shoot vertically, my bullets disregard the presence of terrain and eat it right up. What would the script for vertical shots be?
|
Thu Nov 12, 2009 1:53 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Terrain proximity MOPixel deletion
you'd have to use caststrengthrays, cause obstaclerays will hit MOs and make the bullet useless. look at the sceneman docs for reference
|
Thu Nov 12, 2009 2:32 am |
|
|
whitty
Joined: Sat Jun 16, 2007 2:31 am Posts: 2982 Location: Texas
|
Re: Terrain proximity MOPixel deletion
Lemme explain this a bit more clearly: I'm making a gun that shoots a massive amount of bullets along a single line. The bullets are meant to kill virtually anything, which is a downside because of terrainrape. Then I remembered I saw the terrain code and applied that to the bullets. However, it only works the closer I am to aiming horizontally. The farther away from aiming along the horizontal axis, the more terrain it goes through.
|
Thu Nov 12, 2009 2:38 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Terrain proximity MOPixel deletion
i know what it does. if you use strengthrays to check for terrain rather than altitude (which checks directly below the particle) you're more likely to have success.
|
Thu Nov 12, 2009 2:40 am |
|
|
whitty
Joined: Sat Jun 16, 2007 2:31 am Posts: 2982 Location: Texas
|
Re: Terrain proximity MOPixel deletion
...Right. So how do I do that?
|
Thu Nov 12, 2009 4:42 am |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Terrain proximity MOPixel deletion
The other problem with this is that altitude is determined by basically moving the particle's position to the ground below it. If you're shooting upward, there's never ground below it until it's inside of the terrain, because the terrain is above it. If you're shooting downward, chances are that the bullet is moving too fast for it to detect the altitude before it's already in the terrain. tl;dr just use a strength raycast.
|
Thu Nov 12, 2009 4:44 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Terrain proximity MOPixel deletion
Or have a StrengthRay that points in the direction of the MOPixel's direction, which is what I use in my Flechette gun. Code: local terrcheck = Vector(0,0); if SceneMan:CastStrengthRay(self.Pos,Vector(self.Vel.X,self.Vel.Y):SetMagnitude(10),0,terrcheck,0,0,true) then Change the "SetMagnitude" to the length of the ray (in pixels). "terrcheck" is where the terrain pixel was struck, so you don't need to touch that.
|
Thu Nov 12, 2009 4:54 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Terrain proximity MOPixel deletion
its funny how we all said the same thing.
|
Thu Nov 12, 2009 6:06 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Terrain proximity MOPixel deletion
Oops. Well, at least if whitty doesn't understand one of our posts, he has 2 other to look at.
|
Thu Nov 12, 2009 12:24 pm |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: Terrain proximity MOPixel deletion
indeed. and if anyone else asks this question ever again, they'll get slaughtered.
|
Thu Nov 12, 2009 1:53 pm |
|
|
|