moving vertices that were hit

Blitz3D Forums/Blitz3D Beginners Area/moving vertices that were hit

ryan scott(Posted 2006) [#1]
i want to make this deformable object, some kind of organic looking cell that when you hit it, the spot that you hit shrinks away from the bullet.

i wonder if there's an example of this anywhere?

i think i see the basic components i'm supposed to use but an example of mesh deformation in the spot where something hits the mesh, would really save a ton of time


Paul Murray(Posted 2006) [#2]
The castle demo has terrain that responds to damage I think.


puki(Posted 2006) [#3]
I never knew that - don't think it does - unless I completely overlooked it.


jhocking(Posted 2006) [#4]
Yes, it does.

The commands you would use to do this include CollisionTriangle and TriangleVertex to determine which vertices to move, and then VertexCoords to move them.


puki(Posted 2006) [#5]
Hah, so it does - I never knew that.

I smell a 'Magic Carpet' clone coming out of the woodwork here.


EDIT:
I never spotted it before because the controls are so bad.


ryan scott(Posted 2006) [#6]
hmm thanks, but still confused. the docs are incredibly opaque when it comes to vertices, etc.

in BULLETS.bb:

cc=CountCollisions(b\piv)
If cc > 0
For collisionindex=1 To cc 		
	entity=CollisionEntity(b\piv,collisionindex)
	ID=GetEntityType(entity)
	Select ID
	Case T_GENERATOR

	g.generator = Object.generator(EntityName(entity))
	generatorHIT(g.generator,b.bullet_type,collisionindex)
...

now generatorHIT is:

Function generatorHIT(g.generator,b.bullet_type,collisionindex)

   tcol=CollisionTriangle ( g\model,collisionindex )
   scol=CollisionSurface ( g\model,collisionindex )
   VertexCoords scol,tcol,VertexX#(scol,tcol),VertexY#(scol,tcol),VertexZ#(scol,tcol)+3
	
End Function


I get vertex index out of range on vertexcoords. I don't see where TriangleVertex comes into play. It says it returns a vertex, but what do you do with that? What's that number even mean? is that one particular corner of the triangle? is that a different index than the tcol index?

i think i see what's going on, but the docs again are extremely poor in regard to this topic.

:(

any help greatly appreciated!


ryan scott(Posted 2006) [#7]
i changed it to this
	 	tcol=CollisionTriangle ( g\model,collisionindex )
	 	scol=CollisionSurface ( g\model,collisionindex )
	 	tvert=TriangleVertex ( scol,tcol,Rand(1,3) ) ; which specific vertext to move.  just picking 1st one for now.
		VertexCoords scol,tvert,VertexX#(scol,tvert),VertexY#(scol,tvert),VertexZ#(scol,tvert)+5


and it seems to work.

well i hope this code helps someone equally lost on moving verts