splash on the water

Blitz3D Forums/Blitz3D Beginners Area/splash on the water

Santiworld(Posted 2008) [#1]
hi, i have crates underwater, climbing to surface, when the crates touch the surface i want create an splash sprite... crates are very light, so the go fast, and fly for a second, bounce 2 times...

i do this... (sorry my english)

if entityy#(crate) = 0 then make splay

that works, but now allways, becouse the crate pass maible from -0.001 to 0.0015, and no pass to 0

if i use

int(entityy#(crate)) = 0
thats create mabie 40 sprites when pass surface, and i only need one..

i dont want make collisions, i use ode, for crates..

any help is very welcome...

saludos..


Warner(Posted 2008) [#2]
old_y# = new_y#
new_y# = entityy(crate)

if sgn(new_y) = -sgn(old_y) then create splash at (x,0,z)



mtnhome3d(Posted 2008) [#3]
use the > instead of =


Santiworld(Posted 2008) [#4]
excelent!... thanks!!...


i use that, post the example..

old_y#= entityy#(ode\mesh,1)
RotateEntity ode\mesh,dGeomGetPitch#(ode\geom),dGeomGetYaw#(ode\geom),dGeomGetRoll#(ode\geom)
PositionEntity ode\mesh,dGeomGetPositionX#(ode\geom),dGeomGetPositionY#(ode\geom),dGeomGetPositionZ#(ode\geom)
new_y# = entityy#(ode\mesh,1)

;CREAR SPRITE DE OLA CUANDO LA CAJA TOCA EL AGUA

if ode\id = 1 and sgn(new_y#) = - sgn(old_y#) then

sprite.sprite = new sprite
sprite\entidad = loadmesh("..\b3d\sprite.b3d",ode\mesh)
scaleentity sprite\entidad,.1,1,1,1
positionentity sprite\entidad,0,0,0
entityparent sprite\entidad,0
rotateentity sprite\entidad,0,0,0,1
entitytexture sprite\entidad,st_splash
entitycolor sprite\entidad,100,200,260
entityalpha sprite\entidad,.5
;entityorder sprite\entidad,1
sprite\vida# = 200
gene = 1
sprites= sprites + 1

end if