Warp mesh ?
Blitz3D Forums/Blitz3D Programming/Warp mesh ?
| ||
Hi, I 'm trying to think as to deform the ground by the impact of a bomb falling on the ground or any mesh , my tests are more focused to a meteor impact , but I really do not know how . In this has to do TformPoint ?, I would like someone to tell me that this form command means is that point refers to a point. Greetings. Edit For c% = 1 To CountCollisions(terreno%) colisionBomba% = GetEntityType(bomba%) If c% = colisionbomba% Then RuntimeError "Boom!!" Next Edit 2 no work for me. For c% = 1 To CountCollisions(terreno%) colisionBomba% = GetEntityType(bomba%) If c% = colisionbomba% Then x# = EntityX(bomba%,True) y# = EntityY(bomba%,True) z# = EntityZ(bomba%,True) TFormPoint (x#, y#, z#, terreno%, 0 ) ModifyTerrain ( terreno, TFormedX(), TFormedY()-100, TFormedZ(),True) End If Next |
| ||
You can see how to deform a blitz3d terrain in the demo Blitz3D\samples\mak\castle also an example to modify the height with 0.1 precision : TerrainB3D = CreateTerrain(32) ScaleEntity(TerrainB3D,1,25.5,1) ;(max height of 25.5) TerrainDetail(TerrainB3D,2048,True) TerrainShading(TerrainB3D,True) PositionEntity(TerrainB3D,0,0,0) For HX% = 0 To 32-1 For HZ% = 0 To 32-1 HeightRGB% = Rand(030,035) ;(height between 3.0 and 3.5 on a greyscale heightmap) Height# = 1.0/255*HeightRGB ;(height in percent, if i remember correctly) ModifyTerrain(TerrainB3D,HX,HZ,Height,False) Next Next |
| ||
Thanks, but as I make a crater in the ground , I mean detect the coordinates of impact on terrain mesh and make a hole. |
| ||
Hehehe Yue. I did this years ago making use of some code from around here. Didn't know what I was doing but it worked more or less. I'll look it up... found it : |
| ||
So basically you shoot bullet entity at the terrain and when it collided with terrain you execute this function. I used it like this.. bullitX#=EntityX(b\entity) bullitY#=EntityY(b\entity) bullitZ#=EntityZ(b\entity) PositionEntity b\entity,bullitX#,bullitY#+fall,bullitZ# ;fall to earth when velocity gets below threshold (1) ; if bullit is at terrainheight then explode & hide If bullitY#<TerrainY(terrain,bullitX#,bullitY#,bullitZ#)+4 Or EntityCollided(b\entity,col_level) ; create different response for what has been hit later.. b\inflight=0 ;flight has finished, so set flag & a MakeGrenadeExplosion MakeGrenadeExplosion(b\entity) HideEntity b\entity ; hide shot collided bullir EndIf Oh and btw you need to put a ; before the scorch bit, for I think it's something I added leaving a black stain on the crater. or use this with it: And: Result is something like this: |
| ||
Ok , I have no problems , I have a bomb falling on the ground and leaving a huge crater. Thank you very much. :) |
| ||
Nice. :-) |
| ||
These are meant for a meteor storm on Mars? So that the Rover needs to run away from them? |
| ||
@Rick Nasher, Yes, If so , this is intended for meteors . if I remember correctly , it was your idea. :) |
| ||
:-D |
| ||
|
| ||
@ GF: ha, you took out my mods, making it pure again. :-) |
| ||
LMFAO! ~GF |