verlet constraints

Blitz3D Forums/Blitz3D Programming/verlet constraints

OK, so since everyone else is working on ragdoll physics, rigid body, etc., I thought I would work on my own version in order to learn all about it.

I got most everything working, except for constraining distances. Here is my function:

Function verlet_close_distance(entity_1)
	Stop
	verlet_data.verlet = First verlet
	While verlet_data\entity <> entity_1
		verlet_data = After verlet_data
	Wend
	For x = 1 To verlet_max_connections
		If verlet_data\links[x] > 0
			link = verlet_data\links[x]
			distance# = EntityDistance#(entity_1,link)
			If distance# > verlet_data\distance#[x]
				yaw# = EntityYaw#(link)
				pitch# = EntityPitch#(link)
				roll# = EntityRoll#(link)
				range# = distance# - verlet_data\distance#[x]
				PointEntity link, entity_1,True
				MoveEntity link, range#, 0, 0
				RotateEntity link, pitch#, yaw#, roll#, True
			EndIf
		EndIf
	Next
End Function


Yes, yes, I know that the loop at the begining is inefficent, but this is just a test function which I will optimize later.

For some reason, objects aren't constrained. Instead, they just kind of orbit around each other in an irratic pattern. Since so many people have been writing this stuff lately, I am sure someone has encoutered this?