View unanswered posts | View active topics It is currently Thu Jan 02, 2025 9:48 pm



Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
 Shaped charges / directional gibbing 
Author Message
User avatar

Joined: Fri Jan 26, 2007 8:27 pm
Posts: 40
Location: England
Reply with quote
Post Shaped charges / directional gibbing
Hello all, I've got a fairly simple question. I've got a rocket launcher but I think it would be improved by having a kind of shaped charge warhead to penetrate bunker walls that it hits, and I was trying to do this by making it gib a narrow cone of sharp particles. That's simple enough but the direction of gibbing seems to be relative to the world rather than the orientation of the projectile, so the particles spread in a cone centred to the right of the screen not in front of the rocket where I want them.

I tried using EmissionAngleDegrees = 180 but this of course didn't work because it's only for AEmitter emissions. Is there a similar command to make gibs go at a certain relative orientation without using InheritsVelocity, which I've found to be quite buggy?


Sun Sep 19, 2010 12:40 am
Profile
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: Shaped charges / directional gibbing
Heh, I almost made a post telling you to set InheritsVelocity to 1.
What sorts of bugs are you encountering with it? I've never run into any problems.


Sun Sep 19, 2010 12:43 am
Profile WWW
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Shaped charges / directional gibbing
I think you have to change the Spread of each particle if you want to do that. I'm pretty sure the spread is expressed in radians.


Sun Sep 19, 2010 12:44 am
Profile WWW
User avatar

Joined: Fri Jan 26, 2007 8:27 pm
Posts: 40
Location: England
Reply with quote
Post Re: Shaped charges / directional gibbing
Ah, the problems I've had with using InheritsVel is that projectiles often seem to bounce off the surface they hit just a milisecond before gibbing and the frag all comes back at you. Happens quite often with all kinds of explosive weapons, particularly against actors and rockets but sometimes against terrain too. Try firing a Flak Cannon at something hard at close range; the flak usually doesn't make dent in the target and instead comes back at you really fast and it looks to me like the projectile was reflected just before it went off. This won't make for a very good bunker-busting weapon will it?

As for setting the spread, I've already done this and the frags come out in a narrow cone just as I want them to. The problem is that this cone does not point forwards (in the direction of travel of the rocket) but right, as in positive-X direction on the map.

Even if I did use InheritsVel and worked out a way not to make the frags get reflected, this still means that the speed of the penetrating explosion is entirely tied to the speed of the rocket when it impacts - not really ideal, but I guess it could be a compromise if nothing else works.


Last edited by Entropy on Sun Sep 19, 2010 1:13 am, edited 1 time in total.



Sun Sep 19, 2010 12:55 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Shaped charges / directional gibbing
You could always give it some lua to have your gibs/whatever go at a set speed when the rocket explodes.


Sun Sep 19, 2010 1:12 am
Profile WWW
User avatar

Joined: Fri Jan 26, 2007 8:27 pm
Posts: 40
Location: England
Reply with quote
Post Re: Shaped charges / directional gibbing
Well if anyone could point me in the right direction with Lua coding I'd love that, but I don't know much about it myself. I've only cannibalised bits of code from other people in the past and patched them together (badly) to make a kind of distance-graduated fallout radiation.

I'm guessing what to do would be to have the rocket check its direction every, say 100ms, and then instruct certain gibs to be thrown in this direction if the rocket should gib. Sadly I could just about do the first part of this but I have no idea how to do the second part....


Sun Sep 19, 2010 1:16 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Shaped charges / directional gibbing
No, I'd just make everything InheritsVel = 1 and put code on each of the gibs in the Create(self) function so that they all start out at some desired speed.


Sun Sep 19, 2010 1:27 am
Profile WWW
User avatar

Joined: Fri Jan 26, 2007 8:27 pm
Posts: 40
Location: England
Reply with quote
Post Re: Shaped charges / directional gibbing
Could you explain what code I should use please? "Put some code on them to make them go the desired speed" isn't very helpful to someone who doesn't know Lua.


Sun Sep 19, 2010 1:36 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Shaped charges / directional gibbing
It might look something like this:
Code:
function Create(self)
   self.Vel = 45 + math.random(0,10)
end

You'd just put that code on everything that you want to fly at high speeds, in addition to InheritsVel = 1, and it wont matter what the speed of the rocket is when it explodes, but it will still inherit the direction of the velocity from the rocket.
Note that that is untested code.


Last edited by CrazyMLC on Sun Sep 19, 2010 1:44 am, edited 1 time in total.



Sun Sep 19, 2010 1:41 am
Profile WWW
User avatar

Joined: Fri Jan 26, 2007 8:27 pm
Posts: 40
Location: England
Reply with quote
Post Re: Shaped charges / directional gibbing
Thank you, I'll give this a try tomorrow when I've had some sleep (it's 1:42AM now as I type this) and see if it works. :)


Sun Sep 19, 2010 1:43 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Shaped charges / directional gibbing
If I remember correctly you can also just use InheritsVel = 1 and have negative bounce on the rocket particle. That's how we used to do it in pure .ini, unless I'm forgetting something.

Also MLC that won't work because Velocity is a vector not a scalar.


Sun Sep 19, 2010 5:58 am
Profile WWW
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Shaped charges / directional gibbing
Thought so.
There should be a way to do it like that, though.


Sun Sep 19, 2010 6:00 am
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Shaped charges / directional gibbing
Darlos did something like also putting a thing in front of the bullets with negative bounce to send them flying forwards, but with the desired bounce. Try checking Darkstorm and peeking inside the missile code if you just want to do it in pure ini, unless Darlos has since switched it over to Lua.


Sun Sep 19, 2010 6:07 am
Profile WWW
User avatar

Joined: Sat Nov 03, 2007 9:44 pm
Posts: 1916
Location: Flint Hills
Reply with quote
Post Re: Shaped charges / directional gibbing
Dealing with bounce, friction, and velocity inheritance can perform the general function you want, but in my experience, those methods don't achieve consistent results. (bad for balance, occasionally weak, occasionally overpowered)

I suggest you make an emitter that immediately bursts, with varying spread/velocity values for different emissions. (the emissions would be your explosion particles)
Make that emitter a gib of the rocket; it should be able to properly inherit the angle. (then immediately bursting, exploding directionally in the right direction at consistant velocities)

If the explosion's direction is off due to the impact that gibs the rocket, that can be solved with some simple Lua, which I suppose I could do for you if you want. PM me if you'd want that.


Sun Sep 19, 2010 11:53 am
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Shaped charges / directional gibbing
I think i have a pretty decent idea on how to get this to work properly. It's slightly Lua intensive and i haven't tried it myself, but i could see it working. Basically, the projectile casts an obstacle ray at every frame, and if it hits something, gib the projectile. The projectile should obviously have InheritsVel on all its gibs, and the gibs should fly out at a rather low velocity to give the idea of a directional blast. It could look like this:
Code:
function Create(self)
    self.endPos = Vector(0, 0);
end

function Update(self)
    local length = SceneMan:CastObstacleRay(self.Pos, self.Vel/3, Vector(0, 0), self.endPos, self.ID, 0, 0);
    local trueLength = SceneMan:ShortestDistance(self.Pos, self.endPos, true).Magnitude;
    if trueLength < self.Vel.Magnitude/3 then
        self:GibThis();
    end
end

SHOULD work, though it'll probably fail a bit at point blank range.


Tue Sep 21, 2010 9:27 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 20 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.072s | 13 Queries | GZIP : Off ]