Blast craters
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
05-30-2006 09:13
Okay, this isn't what I'm actually working on but it's basically the same idea so I can discuss without revealing anything =) Basically assume I'm making a mortar, now, I want to fire this into the air, so it arcs down and hits a surface, however, when it hits the surface (or the ground itself) I want it to spawn a blast crater, ie a flat prim with a scorch mark texture on the top. Now, timing isn't important, as the mortar can be timed or something. My thoughts are to have another physical object rezzed by the mortar shell that should base down, that is with it's base flat against whatever surface it has landed on, be it the edge of a slope, or a ramp or ordinary flat floor. However, I can't think of a way to guarantee that it won't get stuck on its side or something. So, I'm looking for ideas, anyone got a way to make an object that detects what angle of surface it just hit? E.g if the mortar were a sticky grenade type thing and attached to a wall to explode, how would I know. I'm thinking possibly collisions, but these will these detect land collisions? Example scripts would be awesome, but if you know a way to do it and describe it I ought to be able to figure out once I know the functions to use  Cheers!
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
05-30-2006 09:25
Well, if it hits the ground (detected using land_collision_start()) there's a function that gives you the normal vector to the ground at that point - llGroundNormal. You can use that to rez a crater object with the correct rotation.
For hitting another object... no, I can't think of a way, it's hard enough to tell where you hit something in general.
I seem to recall somebody building a mortar which used land functions to create craters, which I thought was a pretty cool idea, though it wouldn't work anywhere you didn't have rights to modify land of course.
|
|
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
|
05-30-2006 09:31
You could also use llGroundSlope, they're orthogonal. e.g. land_collision_start(vector pos) { // various impact effects here rotation rot = llRotBetween(<1.0, 0.0, 0.0>, llGroundSlope(pos - llGetPos())); llRezObject("crater", pos, ZERO_VECTOR, rot, 1); llDie(); }
rotation rot = llRotBetween(<0.0, 0.0, 1.0>, llGroundNormal(pos - llGetPos())) would work as well. (Assuming I've not screwed that up, which is quite possible, I'm not in SL to test it and I hate rotations.)
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
05-30-2006 09:44
Awesome! The land collision work great using the llGroundNormal() variation  Hrm, now for object collisions, *scratches brain* maybe there's a nasty way of finding a rough normal for that too, hmmm....
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Ranma Tardis
沖縄弛緩の明確で青い水
Join date: 8 Nov 2005
Posts: 1,415
|
05-30-2006 09:50
Wonderous! Another way for grifers to do their thing throughout SL! At this time it is only explosions and direct fire. Now we are going to be subject to indirect fire and have our land pot marked with holes? Just great! Another way for the frackers to be jerks!
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
05-30-2006 10:15
I doubt I'm the only person to whom the idea of a mortar has occurred, and I suspect there are some out there already. All I'm interested in is the crater effect, thus my asking  I have no ntention to develop any weapons except maybe simple ones for part of an avatar, but they'd be nerfed. E.g swords or pistols causing damage only, no pushing or nonsense like that, those disgust me. But yeah, craters only  I'm currently trying to use other rezzed objects to get an idea of where an item is but not having much luck. I might trying having it fire several small objects which report if they collide or not, just to try and get an idea of the surface. e.g, if I fire them out up, down, left, right, forward and backward, and the down and backward ones are blocked, then the main projectile is likely to be on a angled slope which is BEHIND it and angled downwards...in theory at least.
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
|
05-30-2006 11:31
I remember seeing demonstrated a mortar which went the whole way and used llModifyLand to make a literal crater.  Of course you'd need to have land edit permission on a terraformable island to use it fully, but still...
|
|
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
|
05-30-2006 14:35
when the projectile hits, stop it (it probably will have bounced) and have it move down slowly until it stops (look for a very small net change in position rather than zero velocity). Best way would be to use llMoveToTarget in small increments straight down. Make sure it's not trying to rotate in a certain direction then after it stops, rez your scorch mark.
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
05-30-2006 15:25
You could try working with your position when you collide, the position of what you collided with, its rotation and its bounding box. It should be possible to work out which face of the bounding box you collided with and so which way up the scorch should be rezzed. This will of course work best if you're firing at a bunch of large cuboids.
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Aliasi Stonebender
Return of Catbread
Join date: 30 Jan 2005
Posts: 1,858
|
05-30-2006 15:41
From: Ranma Tardis Wonderous! Another way for grifers to do their thing throughout SL! At this time it is only explosions and direct fire. Now we are going to be subject to indirect fire and have our land pot marked with holes? Just great! Another way for the frackers to be jerks! Are you ever positive about something, Ranma?
_____________________
Red Mary says, softly, “How a man grows aggressive when his enemy displays propriety. He thinks: I will use this good behavior to enforce my advantage over her. Is it any wonder people hold good behavior in such disregard?” Anything Surplus Home to the "Nuke the Crap Out of..." series of games and other stuff
|