Data Realms Fan Forums
http://45.55.195.193/

Terrain proximity MOPixel deletion
http://45.55.195.193/viewtopic.php?f=73&t=17114
Page 1 of 1

Author:  whitty [ Thu Nov 12, 2009 1:53 am ]
Post subject:  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?

Author:  Geti [ Thu Nov 12, 2009 2:32 am ]
Post subject:  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

Author:  whitty [ Thu Nov 12, 2009 2:38 am ]
Post subject:  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.

Author:  Geti [ Thu Nov 12, 2009 2:40 am ]
Post subject:  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.

Author:  whitty [ Thu Nov 12, 2009 4:42 am ]
Post subject:  Re: Terrain proximity MOPixel deletion

...Right.
So how do I do that?

Author:  TheLastBanana [ Thu Nov 12, 2009 4:44 am ]
Post subject:  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.

Author:  CaveCricket48 [ Thu Nov 12, 2009 4:54 am ]
Post subject:  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.

Author:  Geti [ Thu Nov 12, 2009 6:06 am ]
Post subject:  Re: Terrain proximity MOPixel deletion

its funny how we all said the same thing.

Author:  CaveCricket48 [ Thu Nov 12, 2009 12:24 pm ]
Post subject:  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.

Author:  Geti [ Thu Nov 12, 2009 1:53 pm ]
Post subject:  Re: Terrain proximity MOPixel deletion

indeed. and if anyone else asks this question ever again, they'll get slaughtered.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/