in my first post, I wanted an animation of the hands (for the paraglider brakes)
my goal is to have a neutral character who can fulfill different roles (car pilot / kayaker (my next game) ...)
if you have animation for walking / running, so much the better, but in this case it's not essential
I will maybe integrate it in the 3d examples of PB, so we need something quite light, a mesh like this:
I would also like the unit of length to be the meter (it's boring these meshes which are in arbitrary units, it forces them to be scaled)
below a small program to show you the management of bones (paraglider ninja !)
Code: Select all
Define.f depx,depz,mousex,mousey,dist,a, rotx,roty,rotz,drot=1
Define i,j,fdf=1,ex,ey
Global Dim Bone.s(100)
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
OpenWindow(0, 0, 0, 0,0, "Manual animation moving: arows keys+mouse - clic: select bone - F1-F2 rot X - F3-F4 rot Y - F5-F6 rot Z - F12: Wireframe/Solid",#PB_Window_Maximize)
ex=WindowWidth (0,#PB_Window_InnerCoordinate)
ey=WindowHeight(0,#PB_Window_InnerCoordinate)
OpenWindowedScreen(WindowID(0), 0, 0, ex, ey, 0, 0, 0)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Models", #PB_3DArchive_FileSystem)
Parse3DScripts()
CreateCamera(0, 0, 0, 100, 100):MoveCamera(0,0,2,-3):CameraLookAt(0,0,1,0)
CreateLight(0,$ffffff, 1000, 500, -200)
CameraBackColor(0,$ff8888)
AmbientColor($888888)
CreateSprite(0,32,32):StartDrawing(SpriteOutput(0)):LineXY(16,0,16,32,$ffffff):LineXY(0,16,32,16,$ffffff):StopDrawing()
LoadMesh(0, "ninja.mesh")
CreateMaterial(0, LoadTexture(0, "nskingr.jpg"))
CreateEntity(0, MeshID(0), MaterialID(0),0,0,0,1):ScaleEntity(0,0.01,0.01,0.01)
CreateSphere(100,0.01)
DisableDebugger:CreateMaterial(100,0):EnableDebugger
Procedure refreshbones()
For i=1 To 27
Bone(i) = "Joint"+Str(i)
EnableManualEntityBoneControl(0, Bone(i), #True, #True)
;CreateEntity(100+i,MeshID(100),MaterialID(100),0,0,0,2):AttachEntityObject(0, Bone(i), EntityID(100+i))
CreateEntity(100+i,MeshID(100),MaterialID(100),EntityBoneX(0,Bone(i)),EntityBoneY(0,Bone(i)),EntityBoneZ(0,Bone(i)),2)
Next
EndProcedure
refreshbones()
RotateEntityBone(0, bone(2),28,0,0,0)
RotateEntityBone(0, bone(3),-10,0,0,0)
RotateEntityBone(0, bone(4),-10,0,0,0)
RotateEntityBone(0, bone(18),80,0,0,0):RotateEntityBone(0, bone(19),-90,0,0,0)
RotateEntityBone(0, bone(23),80,0,0,0):RotateEntityBone(0, bone(24),-90,0,0,0)
RotateEntityBone(0, bone(9),80,10,40,0):RotateEntityBone(0, bone(11),80,0,0,0)
RotateEntityBone(0, bone(14),80,-10,-40,0):RotateEntityBone(0, bone(16),80,0,0,0)
;4
;7
Repeat
WaitWindowEvent()
ExamineMouse()
MouseX = -MouseDeltaX() * 0.05
MouseY = -MouseDeltaY() * 0.05
ExamineKeyboard()
depx=(-Bool(KeyboardPushed(#PB_Key_Left))+Bool(KeyboardPushed(#PB_Key_Right)))*0.01
depz=(-Bool(KeyboardPushed(#PB_Key_Down))+Bool(KeyboardPushed(#PB_Key_Up )))*0.01+MouseWheel()*0.1
If KeyboardReleased(#PB_Key_F12):fdf=1-fdf:EndIf
If fdf:MaterialShadingMode(0, #PB_Material_Wireframe):Else:MaterialShadingMode(0,#PB_Material_Solid):EndIf
If KeyboardReleased(#PB_Key_F10):EnableManualEntityBoneControl(0, Bone(0), #False, #True) :EndIf
If MouseButton(1)
ab=b:b=MousePick(0,ex/2,ey/2,2)-100:If ab<>b:Debug b:EndIf
EndIf
If b>=0
rotx=(-Bool(KeyboardPushed(#PB_Key_F1))+Bool(KeyboardPushed(#PB_Key_F2)))*drot
roty=(-Bool(KeyboardPushed(#PB_Key_F3))+Bool(KeyboardPushed(#PB_Key_F4)))*drot
rotz=(-Bool(KeyboardPushed(#PB_Key_F5))+Bool(KeyboardPushed(#PB_Key_F6)))*drot
RotateEntityBone(0, bone(b),rotx,roty,rotz, #PB_Relative)
refreshbones()
EndIf
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative):dist+(depz-dist)*0.5:MoveCamera (0, depX, 0, -dist)
If KeyboardPushed(#PB_Key_Space):a+0.2:RotateEntity(0,a,a*2,a*3,0):EndIf
RenderWorld()
DisplayTransparentSprite(0,ex/2-16,ey/2-16)
FlipBuffers()
Until KeyboardReleased(#PB_Key_Escape) Or MouseButton(3)
For i=1 To 27
Debug ""+i+" rx: "+EntityBonePitch(0,bone(i))+" ry: "+EntityBoneYaw(0,bone(i))+" rz: "+EntityBoneRoll(0,bone(i))
Next