Ragdoll

Blitz3D Forums/Blitz3D Beginners Area/Ragdoll

If, for example, I was to make a ragdoll simulation, how would I pivot different body parts to each other, but not pivoting around the center point?

Is there a way to control bones from within Blitz, because this would help mucho as an alternative.

Hmm :/ not sure if this is what you need, but still:
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()

cam = CreateCamera()
MoveEntity cam, 0, 0, -15


;------------------body+head----

body = CreateCube()
PositionEntity body, 0, 0, 0, 1

ScaleMesh body, 0.5, 1, 0.5
EntityColor body, 0, 0, 255

head = CreateSphere(8, body)
PositionMesh head, 0, 1, 0
MoveEntity head, 0, 1, 0
EntityColor head, 255, 230, 200

;------------------left arm----


arm1_U = CreateCube(body)
ScaleMesh arm1_U, 1, 0.1, 0.1
PositionMesh arm1_U, 1, 0, 0
PositionEntity arm1_U, 0.5, 0.8, 0
EntityColor arm1_U, 255, 230, 200

arm1_L = CreateCube(arm1_U)
ScaleMesh arm1_L, 1, 0.1, 0.1
PositionMesh arm1_L, 1, 0, 0
PositionEntity arm1_L, 2, 0, 0
EntityColor arm1_L, 255, 230, 200

hand1 = CreateSphere(8, arm1_L)
ScaleMesh hand1, 0.4, 0.4, 0.4
PositionEntity hand1, 2, 0, 0

;------------------right arm----

arm2_U = CreateCube(body)
ScaleMesh arm2_U, 1, 0.1, 0.1
PositionMesh arm2_U, -1, 0, 0
PositionEntity arm2_U, -0.5, 0.8, 0
EntityColor arm2_U, 255, 230, 200

arm2_L = CreateCube(arm2_U)
ScaleMesh arm2_L, 1, 0.1, 0.1
PositionMesh arm2_L, -1, 0, 0
PositionEntity arm2_L, -2, 0, 0
EntityColor arm2_L, 255, 230, 200

hand2 = CreateSphere(8, arm2_L)
ScaleMesh hand2, 0.4, 0.4, 0.4
PositionEntity hand2, -2, 0, 0

;-----------------main loop------

d = 1
Repeat

	i = i + 1
	If i = 67 Then i = 0: d = -d
	
	TurnEntity arm1_U, 0, 0, d * -1
	TurnEntity arm1_L, 0, 0, d *  2

	TurnEntity arm2_U, 0, 0, d *  1
	TurnEntity arm2_L, 0, 0, d * -2
	
	RenderWorld
	Text 0, 0, i
	Flip
	
Until KeyHit(1)

End

This code demonstrates, that to change the point where a mesh rotates, you could use PositionMesh.

What is it that you want to do ? You could maybe load in a .b3d skeleton, and then attach a mesh to it later on.

And I believe you can move, turn and rotate bones ? Use the GetChild/FindChild command to find them.
bone = FindChild("footbone")
turnentity bone, 1, 0, 0


For more control over the B3D bones, you could open the B3D, change the properties and save it back again with Ricky Smiths code:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1794

Also, I believe there is a ragdoll example in one of the physics libraries. I saw one in the Newton wrapper examples.

Thanks a lot! I'm still a little confused, but I think this helped.