Re: RagDoll Ogre PhysikEngine
Verfasst: 24.09.2018 16:30
Beta halt.
Sobald 5.70 in echt da ist guck ich mir das nochmal an
Sobald 5.70 in echt da ist guck ich mir das nochmal an
Danke.bobobo hat geschrieben:Beta halt.
Sobald 5.70 in echt da ist guck ich mir das nochmal an
Recht hast Du.Kurzer hat geschrieben:wenn das jeder so handhaben würde, dann wäre aufgrund von fehlendem feedback die beta gleich der final version.
sinn einer beta ist es sie mit vorhandenem codes zu testen.
bobobo hat geschrieben:... eure persönliche Faulheit ...
... und das passende Possessivpronomen offenbar auch nicht.bobobo hat geschrieben:Die Beta fass ich nicht an.
Ehrlich? Wer hätte das gedacht? Und wer hat etwas gegenteiliges gesagt?DrShrek hat geschrieben:Er muss nix tun.
Kriege? Du hast merkwürdige Assoziationen.DrShrek hat geschrieben:... aber deswegen Kriege führen müssen wir nicht
Code: Alles auswählen
;
;
; ------------------------------------------------------------
;
; PureBasic - RagDoll
;
; (c) 2002 - Fantaisie Software , bobobo
; OpenGL scheitert bei mir, das mag am Treiber liegen (Laptop)
; das Programm sollte im Verzeichnis \Examples\3D liegen
; weil es auf den Screenrequester und andere Daten dort zugreift
; alles ohne Gewähr
; ------------------------------------------------------------
;ApplyEntityimpulse angepasst
#CameraSpeed = 0.5
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY ,rott, moveit
Define.i Knupf1,knupf2, Knupf3 , hands
Structure components
nodeid.i
ball.i
limb.i
texture.i
Bodymesh.i
Body.i
HeadMesh.i
Head.i
Nose.i
eyer.i
eyel.i
mouth.i
earl.i
earr.i
arml.i
armlu.i
armr.i
armru.i
legl.i
leglu.i
legr.i
legru.i
footl.i
footr.i
ct_bodyhead.i
ct_arml.i
hinge_arml.i
ct_armr.i
hinge_armr.i
hinge_legl.i
hinge_leglu.i
hinge_legr.i
hinge_legru.i
posx.i
posy.i
posz.i
EndStructure
Define ragdoll.components
Global NewList ragdolls.components()
Structure blood
id.i
time.i
EndStructure
bloodygameheight=340
NewList blood.blood()
Procedure killjoints()
ForEach ragdolls()
FreeJoint(#PB_All)
Next
EndProcedure
Procedure makejoints()
;joints
ForEach ragdolls()
RotateEntity(ragdolls()\Head,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\body,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\arml,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\armlu,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\armr,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\armru,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\legl,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\leglu,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\legr,0,0,0,#PB_Absolute)
RotateEntity(ragdolls()\legru,0,0,0,#PB_Absolute)
ragdolls()\ct_bodyhead=ConeTwistJoint(#PB_Any,EntityID(ragdolls()\Body) , 0, 0.7,0,EntityID(ragdolls()\Head) ,0,-0.4,0)
;ragdolls()\ct_bodyhead=PointJoint(#PB_Any,EntityID(ragdolls()\Body) , 0, 0.7,0,EntityID(ragdolls()\Head) ,0,-0.4,0)
ragdolls()\ct_arml = ConeTwistJoint(#PB_Any,EntityID(ragdolls()\Body),-0.6, 0.5 ,0,EntityID(ragdolls()\arml) , 0, 0.4,0)
ragdolls()\hinge_arml = HingeJoint(#PB_Any,EntityID(ragdolls()\arml) , 0, -0.45,0,1,0,0,EntityID(ragdolls()\armlu), 0,0.45,0,1,0,0)
ragdolls()\ct_armr = ConeTwistJoint(#PB_Any,EntityID(ragdolls()\Body), 0.6, 0.5,0,EntityID(ragdolls()\armr), 0, 0.4,0)
ragdolls()\hinge_armr = HingeJoint(#PB_Any,EntityID(ragdolls()\armr) , 0 ,-0.45,0,1,0,0,EntityID(ragdolls()\armru), 0,0.45,0,1,0,0)
ragdolls()\hinge_legl = HingeJoint(#PB_Any,EntityID(ragdolls()\Body) ,-0.3,-0.60,0,1,0,0,EntityID(ragdolls()\legl) , 0,0.40,0,1,0,0)
ragdolls()\hinge_legr = HingeJoint(#PB_Any,EntityID(ragdolls()\Body) , 0.3,-0.60,0,1,0,0,EntityID(ragdolls()\legr) , 0,0.40,0,1,0,0)
ragdolls()\hinge_leglu = HingeJoint(#PB_Any,EntityID(ragdolls()\legl) , 0,-0.45,0,1,0,0,EntityID(ragdolls()\leglu), 0,0.45,0,1,0,0)
ragdolls()\hinge_legru = HingeJoint(#PB_Any,EntityID(ragdolls()\legr) , 0,-0.45,0,1,0,0,EntityID(ragdolls()\legru), 0,0.45,0,1,0,0)
;joints attributes
SetJointAttribute(ragdolls()\ct_bodyhead,#PB_ConeTwistJoint_SwingSpan,0.5)
SetJointAttribute(ragdolls()\ct_bodyhead,#PB_ConeTwistJoint_SwingSpan2,0.5)
SetJointAttribute(ragdolls()\ct_bodyhead,#PB_ConeTwistJoint_TwistSpan,0.5)
; ;
SetJointAttribute(ragdolls()\ct_arml,#PB_ConeTwistJoint_SwingSpan ,0.2);seitl
SetJointAttribute(ragdolls()\ct_arml,#PB_ConeTwistJoint_SwingSpan2,1);dreh
SetJointAttribute(ragdolls()\ct_arml,#PB_ConeTwistJoint_TwistSpan ,2);vorzurück
; ;
SetJointAttribute(ragdolls()\hinge_arml,#PB_HingeJoint_LowerLimit,0)
SetJointAttribute(ragdolls()\hinge_arml,#PB_HingeJoint_UpperLimit,120)
SetJointAttribute(ragdolls()\hinge_armr,#PB_HingeJoint_LowerLimit,0)
SetJointAttribute(ragdolls()\hinge_armr,#PB_HingeJoint_UpperLimit,120)
SetJointAttribute(ragdolls()\ct_armr,#PB_ConeTwistJoint_SwingSpan,0.2);seitlich
SetJointAttribute(ragdolls()\ct_armr,#PB_ConeTwistJoint_SwingSpan2,1);dreh
SetJointAttribute(ragdolls()\ct_armr,#PB_ConeTwistJoint_TwistSpan,2);vorzurück
SetJointAttribute(ragdolls()\hinge_legl,#PB_HingeJoint_LowerLimit,-1)
SetJointAttribute(ragdolls()\hinge_legl,#PB_HingeJoint_UpperLimit,120)
SetJointAttribute(ragdolls()\hinge_legr,#PB_HingeJoint_LowerLimit,-1)
SetJointAttribute(ragdolls()\hinge_legr,#PB_HingeJoint_UpperLimit,120)
SetJointAttribute(ragdolls()\hinge_leglu,#PB_HingeJoint_LowerLimit,-120)
SetJointAttribute(ragdolls()\hinge_leglu,#PB_HingeJoint_UpperLimit,1)
SetJointAttribute(ragdolls()\hinge_legru,#PB_HingeJoint_LowerLimit,-120)
SetJointAttribute(ragdolls()\hinge_legru,#PB_HingeJoint_UpperLimit,1)
Next
EndProcedure
If InitEngine3D()
;Ergebnis = WorldDebug(#PB_World_DebugBody)
Add3DArchive(#PB_Compiler_Home + "/Examples/3D/" +"Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "/Examples/3D/" +"Data/Packs/desert.zip", #PB_3DArchive_Zip)
Parse3DScripts()
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
WorldShadows(#PB_Shadow_Additive,512)
SkyBox("desert07.jpg")
camera=CreateCamera(#PB_Any,0,0,100,100)
MoveCamera(camera,0, 260 ,15, #PB_Absolute)
texture1t=CreateTexture(#PB_Any,256,256)
font=LoadFont(#PB_Any,"",8,#PB_Font_HighQuality)
StartDrawing(TextureOutput(texture1t))
DrawingFont(FontID(font))
Box(0, 0, 256, 256, RGBA(222,222,255, 200))
For l=0 To 128
Circle(Random(256),Random(256),Random(4)+1,RGBA(128,128,255,255))
Next l
DrawingMode(#PB_2DDrawing_Transparent)
FrontColor(#Black)
;BackColor(#Black)
th=TextHeight("X")
ty=0
DrawText(0, 0,"V:Hands OFF/ON (**)")
ty+th
DrawText(0,ty,"U:IdiotDance OFF/ON (**)")
ty+th
DrawText(0,ty,"R:reset (*)")
ty+th
DrawText(0,ty,"B:BloodyGame (**)")
ty+th
DrawText(0,ty,"BloodyGameHeight N:increase , M: decrease (*)")
ty+th
DrawText(0,ty,"T:upright (*)")
ty+th
DrawText(0,ty,"H:hail (*), G:strange (*)")
ty+th
DrawText(0,ty,"T: upright (*)")
ty+th
DrawText(0,ty,"F:forceup (near plate) (trampoline) (*)")
ty+th
DrawText(0,ty,"J:forceup (*)")
ty+th
DrawText(0,ty,"P:LookatAll (*)")
ty+th
DrawText(0,ty,"S:Shoot (**)")
ty+th
DrawText(0,ty,"L:Disassemble , O: Assemble (**)")
ty+th
DrawText(0,ty,"1,2,3,4,6,8 turns head (*)")
ty+th
DrawText(0,ty,"Add:Gravitiy decrease")
ty+th
DrawText(0,ty,"Sub:Gravitiy increase")
ty+th
DrawText(0,ty,"(*) while pressed, (**) when release key")
Debug ty
StopDrawing()
texture1=CreateMaterial(#PB_Any, TextureID(texture1t))
texture2=CreateTexture(#PB_Any,256,256)
StartDrawing(TextureOutput(texture2))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0,0,256,256,RGBA(0,0,0,0))
DrawingFont(FontID(font))
;FrontColor(RGBA(0,0,0,255))
DrawText(0,0,"Press B and have fun",RGBA(255,255,0,255),RGBA(0,0,0,0))
DrawText(0,40,"Hold N for a time and press B",RGBA(255,255,0,255),RGBA(0,0,0,0))
DrawText(0,80,"and have even more fun",RGBA(255,255,0,255),RGBA(0,0,0,0))
StopDrawing()
infomat=CreateMaterial(#PB_Any,TextureID(texture2))
MaterialBlendingMode(infomat,#PB_Material_AlphaBlend)
texture2= CreateTexture(#PB_Any,256,256)
StartDrawing(TextureOutput(texture2))
Box(0,0,256,256,RGBA(80,80,80,180))
For l=0 To 400
Circle(Random(256),Random(256),Random(3)+1,RGBA(Random(5)+100,Random(5)+100,Random(5)+100,180))
Next l
DrawText(0,0,"ragdoll ®",RGBA(255,0,0,255),RGBA(80,80,80,222))
StopDrawing()
texture2=CreateMaterial(#PB_Any, TextureID(texture2))
textureblue = CreateTexture(#PB_Any,256,256)
StartDrawing(TextureOutput(textureblue))
Box(0,0,256,256,#White)
Ellipse(0,128,25,50,RGB(30, 144, 255))
Ellipse(256,128,25,50,RGB(30, 144, 255))
Ellipse(0,128,10,20,RGB(0 , 0, 0))
Ellipse(256,128,10,20,RGB(0 , 0, 0))
StopDrawing()
MatEye = CreateMaterial(#PB_Any,TextureID(textureblue))
textureflesh = CreateTexture(#PB_Any,256,256)
StartDrawing(TextureOutput(textureflesh))
Box(0,0,256,256,RGB(255, 218, 185))
For f=0 To 512
Circle(Random(255),Random(255),Random(2),RGB(243, 208, 161))
Next
StopDrawing()
MatFlesh = CreateMaterial(#PB_Any,TextureID(textureflesh))
texturemouth = CreateTexture(#PB_Any,256,256)
StartDrawing(TextureOutput(texturemouth))
Box(0,0,256,256,#White)
For t=0 To 256 Step 16
Line(t,0,1,256,#Black)
Line(t-1,0,1,256,#Black)
Line(t-2,0,1,256,#Black)
Line(t+1,0,1,256,#Black)
Line(t+2,0,1,256,#Black)
Next t
StopDrawing()
MatMouth = CreateMaterial(#PB_Any,TextureID(texturemouth))
texturekontakt= CreateTexture(#PB_Any,256,256)
StartDrawing(TextureOutput(texturekontakt))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0,0,256,256,RGBA(0,0,0,0))
For c=1 To 32
bx=64+Random(128)
by=64+Random(128)
br=Random(32)
Circle(bx,by,br,RGBA(255,0,0,br*4))
Next c
StopDrawing()
MatKontakt = CreateMaterial(#PB_Any,TextureID(texturekontakt))
MaterialBlendingMode(MatKontakt,#PB_Material_AlphaBlend)
RotateMaterial(MatKontakt,0.005,#PB_Material_Animated)
AddMaterialLayer(MatKontakt,TextureID(texturekontakt),#PB_Material_Add)
Bodymesh = CreateCube(#PB_Any,1)
LimbMesh = CreateCylinder(#PB_Any, 0.1 ,0.80)
HeadMesh = CreateSphere(#PB_Any , 0.5 ,15,15)
NoseMesh = CreateSphere(#PB_Any , 0.25, 3, 4)
EyeMeshl = CreateSphere(#PB_Any , 0.10,20,20)
EyeMeshr = CreateSphere(#PB_Any , 0.10,20,20)
MouthMesh = CreateSphere(#PB_Any , 0.25,15,15)
EarMeshl = CreateSphere(#PB_Any , 0.25,20,20)
EarMeshr = CreateSphere(#PB_Any , 0.25,20,20)
FootMeshl = CreateSphere(#PB_Any , 0.25,20,20)
FootMeshr = CreateSphere(#PB_Any , 0.25,20,20)
kontaktMesh= CreatePlane(#PB_Any,0.25,0.25,1,1,1,1)
TransformMesh(kontaktMesh,0,0.05,0,1,1,1,0,0,0)
kontakt=CreateEntity(#PB_Any,MeshID(kontaktMesh),MaterialID(MatKontakt))
EntityRenderMode(kontakt, #PB_Entity_CastShadow)
TransformMesh(NoseMesh , 0.00, 0.00, 0.50, 1.00, 1.00, 1.00, 0.00, 0.00, 0.00)
TransformMesh(EyeMeshl ,-0.35, 0.20, 0.25, 1.00, 1.00, 1.00, 0.00, 0.00, 0.00)
TransformMesh(EyeMeshr , 0.35, 0.20, 0.25, 1.00, 1.00, 1.00, 0.00, 0.00, 0.00)
TransformMesh(MouthMesh, 0.00,-0.15, 0.22, 1.50, 0.45, 1.00, 40.00, 0.00, 0.00)
TransformMesh(EarMeshl ,-0.50,-0.10,-0.20, 1.00, 1.00, 0.25, 0.00, 0.00, 0.00)
TransformMesh(EarMeshr , 0.50,-0.10,-0.20, 1.00, 1.00, 0.25, 0.00, 0.00, 0.00)
TransformMesh(FootMeshl,-0.05,-0.40, 0.25, 0.50, 0.25, 1.00, 10.00, 0.00, 0.00)
TransformMesh(FootMeshr, 0.05,-0.40, 0.25, 0.50, 0.25, 1.00, 10.00, 0.00, 0.00)
rg=3
If rg<3
rg=3
EndIf
For r=1 To rg ;3 Dinger min
AddElement(ragdolls())
ragdolls()\posx=r*2-2
ragdolls()\posy=260
ragdolls()\posz=0
ragdolls()\texture=texture2
;bodyparts
ragdolls()\Body=CreateEntity(#PB_Any,MeshID(Bodymesh),MaterialID(ragdolls()\texture),ragdolls()\posx,ragdolls()\posy,ragdolls()\posz)
ScaleEntity(ragdolls()\Body,1.0,1,0.25)
ragdolls()\Nose = CreateEntity(#PB_Any,MeshID(NoseMesh) ,MaterialID(MatFlesh))
ragdolls()\eyel = CreateEntity(#PB_Any,MeshID(EyeMeshl) ,MaterialID(MatEye))
ragdolls()\eyer = CreateEntity(#PB_Any,MeshID(EyeMeshr) ,MaterialID(MatEye))
ragdolls()\mouth = CreateEntity(#PB_Any,MeshID(MouthMesh),MaterialID(MatMouth))
ragdolls()\earl = CreateEntity(#PB_Any,MeshID(EarMeshl) ,MaterialID(MatFlesh))
ragdolls()\earr = CreateEntity(#PB_Any,MeshID(EarMeshr) ,MaterialID(MatFlesh))
ragdolls()\Head = CreateEntity(#PB_Any,MeshID(HeadMesh),MaterialID(MatFlesh), ragdolls()\posx,ragdolls()\posy+1,ragdolls()\posz)
AttachEntityObject(ragdolls()\Head,"",EntityID(ragdolls()\Nose) ,0,0,0,0,0,0)
AttachEntityObject(ragdolls()\Head,"",EntityID(ragdolls()\eyel) ,0,0,0,0,0,0)
AttachEntityObject(ragdolls()\Head,"",EntityID(ragdolls()\eyer) ,0,0,0,0,0,0)
AttachEntityObject(ragdolls()\Head,"",EntityID(ragdolls()\mouth),0,0,0,0,0,0)
AttachEntityObject(ragdolls()\Head,"",EntityID(ragdolls()\earl) ,0,0,0,0,0,0)
AttachEntityObject(ragdolls()\Head,"",EntityID(ragdolls()\earr) ,0,0,0,0,0,0)
ragdolls()\arml = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx-0.6,ragdolls()\posy,ragdolls()\posz)
ragdolls()\armlu = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx-0.6,ragdolls()\posy-1,ragdolls()\posz)
ragdolls()\armr = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx+0.6,ragdolls()\posy,ragdolls()\posz)
ragdolls()\armru = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx+ 0.6,ragdolls()\posy-1,ragdolls()\posz)
ragdolls()\legl = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx-0.3,ragdolls()\posy-1,ragdolls()\posz)
ragdolls()\legr = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx+ 0.3,ragdolls()\posy-1,ragdolls()\posz)
ragdolls()\leglu = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx-0.3,ragdolls()\posy-2,ragdolls()\posz)
ragdolls()\legru = CreateEntity(#PB_Any,MeshID(LimbMesh),MaterialID(ragdolls()\texture) ,ragdolls()\posx+ 0.3,ragdolls()\posy-2,ragdolls()\posz)
ragdolls()\footl = CreateEntity(#PB_Any,MeshID(FootMeshl),MaterialID(ragdolls()\texture))
AttachEntityObject(ragdolls()\leglu,"",EntityID(ragdolls()\footl) ,0,0,0,0,0,0)
ragdolls()\footr = CreateEntity(#PB_Any,MeshID(FootMeshr),MaterialID(ragdolls()\texture))
AttachEntityObject(ragdolls()\legru,"",EntityID(ragdolls()\footr) ,0,0,0,0,0,0)
;bodyPhysics
CreateEntityBody(ragdolls()\Body,#PB_Entity_BoxBody ,10, 0,1)
EntityRenderMode(ragdolls()\Body, #PB_Entity_CastShadow)
EntityRenderMode(ragdolls()\Head, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\Head, #PB_Entity_SphereBody, 5, 0.25, 1)
EntityRenderMode(ragdolls()\arml, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\arml, #PB_Entity_CylinderBody, 1, 0 ,1)
EntityRenderMode(ragdolls()\armlu, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\armlu, #PB_Entity_CylinderBody, 1, 0, 1)
EntityRenderMode(ragdolls()\armr, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\armr, #PB_Entity_CylinderBody, 1, 0, 1)
EntityRenderMode(ragdolls()\armru, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\armru, #PB_Entity_CylinderBody, 1, 0,1)
EntityRenderMode(ragdolls()\legl, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\legl, #PB_Entity_CylinderBody, 1, 0,1)
EntityRenderMode(ragdolls()\leglu, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\leglu, #PB_Entity_CylinderBody,1, 0,1)
EntityRenderMode(ragdolls()\legr, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\legr, #PB_Entity_CylinderBody, 1, 0,1)
EntityRenderMode(ragdolls()\legru, #PB_Entity_CastShadow)
CreateEntityBody(ragdolls()\legru, #PB_Entity_CylinderBody,1, 0,1)
Next
makejoints()
;
plate=CreateCube(#PB_Any,1)
ScaleMaterial(texture1,1,1)
RotateMaterial(texture1,90,#PB_Material_Fixed)
platte=CreateEntity(#PB_Any,MeshID(plate),MaterialID(texture1),0,0,0)
ScaleEntity(platte,70,0.01,70)
MoveEntity(platte,0,256,0)
EntityRenderMode(platte, #PB_Entity_CastShadow)
CreateEntityBody(platte,#PB_Entity_StaticBody,1000,1,0.5)
info=CreateEntity(#PB_Any,MeshID(plate),MaterialID(infomat),0,0,0)
ScaleEntity(info,10,0.01,10)
MoveEntity(info,5,260,0)
RotateEntity(info,90,0,0)
EntityRenderMode(info, #PB_Entity_DisplaySkeleton )
suncolor=#White
sun=CreateLight(#PB_Any,suncolor,17830,12860,10930,#PB_Light_Point)
CameraLookAt(camera,EntityX(ragdolls()\Head),EntityY(ragdolls()\Head),EntityZ(ragdolls()\Head))
dance=1
hands=1
Repeat
Debug hands
Debug "************"
Screen3DEvents()
If ExamineMouse()
MouseX = -MouseDeltaX() * #CameraSpeed * 0.05
MouseY = -MouseDeltaY() * #CameraSpeed * 0.05
EndIf
If hands=1
hands=2
;Debug hands
;Händchenhalten
sp=-0.5
tau.f=0
damp.f=0.5
SelectElement(ragdolls(),0)
id=EntityID(ragdolls()\armru) ;First rd arm r
SelectElement(ragdolls(),1)
id1=EntityID(ragdolls()\armlu) ;second rd arm l
knupf1=PointJoint(#PB_Any,id,0,sp,0,id1,0,sp,0)
SetJointAttribute(knupf1,#PB_PointJoint_Damping,damp)
SetJointAttribute(knupf1,#PB_PointJoint_Tau,tau)
id=EntityID(ragdolls()\armru) ; Second rd r
SelectElement(ragdolls(),2)
id1=EntityID(ragdolls()\armlu) ; Third rd arm l
knupf2=PointJoint(#PB_Any,id,0,sp,0,id1,0,sp,0)
SetJointAttribute(knupf2,#PB_PointJoint_Damping,damp)
SetJointAttribute(knupf2,#PB_PointJoint_Tau,tau)
id=EntityID(ragdolls()\armru) ; Third rd arm r
SelectElement(ragdolls(),0)
id1=EntityID(ragdolls()\armlu) ; First arm l
knupf3=PointJoint(#PB_Any,id,0,sp,0,id1,0,sp,0) ; three dolls build a ring
SetJointAttribute(knupf3,#PB_PointJoint_Damping,damp)
SetJointAttribute(knupf3,#PB_PointJoint_Tau,tau)
EndIf
If hands=3
;Debug hands
hands=0
If knupf1
FreeJoint(knupf1)
knupf1=0
EndIf
If knupf2
FreeJoint(knupf2)
knupf2=0
EndIf
If knupf3
FreeJoint(knupf3)
knupf3=0
EndIf
EndIf
If dance=1
;dance=2
ForEach ragdolls()
If EntityY(ragdolls()\Head)<259.5
ApplyEntityImpulse(ragdolls()\Head ,0, 9,0,0,1,0,#PB_World)
ApplyEntityImpulse(ragdolls()\legru ,0, -5,0,0,-1,0,#PB_World)
ApplyEntityImpulse(ragdolls()\leglu ,0, -5,0,0,-1,0,#PB_World)
If EntityY(ragdolls()\leglu)<256.8
ApplyEntityImpulse(ragdolls()\leglu,Random(2)-1,Random(8),Random(2)-1)
EndIf
If EntityY(ragdolls()\legru)<256.8
ApplyEntityImpulse(ragdolls()\legru,Random(2)-1,Random(8),Random(2)-1)
EndIf
ApplyEntityImpulse(ragdolls()\armlu,Random(2)-1,Random(2)-1,Random(2)-1)
ApplyEntityImpulse(ragdolls()\armru,Random(2)-1,Random(2)-1,Random(2)-1)
EndIf
Next
EndIf
KeyboardMode(#PB_Keyboard_International)
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_P) Or KeyboardReleased(#PB_Key_R)
px.f=0
py.f=0
pz.f=0
ForEach ragdolls()
px+EntityX(ragdolls()\Body)
py+EntityY(ragdolls()\Body)
pz+EntityZ(ragdolls()\Body)
Next
px=px/ListSize(ragdolls())
py=py/ListSize(ragdolls())
pz=pz/ListSize(ragdolls())
MoveCamera(camera,0, 260 ,15, #PB_Absolute)
CameraLookAt(camera,px,py,pz)
EndIf
If KeyboardPushed(#PB_Key_N)
bloodygameheight+1
EndIf
If KeyboardPushed(#PB_Key_M)
bloodygameheight-1
If bloodygameheight<290
bloodygameheight=290
EndIf
EndIf
If KeyboardReleased(#PB_Key_O)
killjoints()
hands=0
makejoints()
EndIf
If KeyboardReleased(#PB_Key_L)
killjoints()
hands=0
EndIf
If KeyboardReleased(#PB_Key_B)
px.f=0
py.f=0
pz.f=0
ForEach ragdolls()
px+EntityX(ragdolls()\Body)
py+EntityY(ragdolls()\Body)
pz+EntityZ(ragdolls()\Body)
Next
px=px/ListSize(ragdolls())
py=py/ListSize(ragdolls())
pz=pz/ListSize(ragdolls())
ForEach(ragdolls())
ApplyEntityImpulse(ragdolls()\Body,Random(20)-10,0,Random(20)-10)
ApplyEntityImpulse(ragdolls()\Head,Random(20)-10,0,Random(20)-10)
Next
MoveCamera(camera,px,py+10,pz,#PB_Absolute)
CameraLookAt(camera,0,260,0)
EndIf
If KeyboardPushed(#PB_Key_S) And shoot=0
ForEach ragdolls()
ApplyEntityImpulse(ragdolls()\Body,0,0,-100,Random(8)-4,Random(8)-4,Random(8)-4,#PB_World)
shoot=1
Next
EndIf
If KeyboardReleased(#PB_Key_S)
shoot=0
EndIf
If KeyboardPushed(#PB_Key_R)
ForEach ragdolls()
MoveEntity(ragdolls()\Head,ragdolls()\posx,ragdolls()\posy,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\Body,ragdolls()\posx,ragdolls()\posy-1,ragdolls()\posz,#PB_Absolute)
RotateEntity(ragdolls()\Body,0,0,0,#PB_Absolute)
MoveEntity(ragdolls()\legr,ragdolls()\posx+0.3,ragdolls()\posy-2,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\legl,ragdolls()\posx-0.3,ragdolls()\posy-2,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\legru,ragdolls()\posx+0.3,ragdolls()\posy-2.9,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\leglu,ragdolls()\posx-0.3,ragdolls()\posy-2.9,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\armr,ragdolls()\posx+0.6,ragdolls()\posy-1,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\arml,ragdolls()\posx-0.6,ragdolls()\posy-1,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\armru,ragdolls()\posx+0.6,ragdolls()\posy-2,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\armlu,ragdolls()\posx-0.6,ragdolls()\posy-2,ragdolls()\posz,#PB_Absolute)
Next
EndIf
If KeyboardPushed(#PB_Key_B)
ForEach ragdolls()
MoveEntity(ragdolls()\Head,ragdolls()\posx,bloodygameheight,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\Body,ragdolls()\posx,bloodygameheight-1,ragdolls()\posz,#PB_Absolute)
RotateEntity(ragdolls()\Body,0,0,0,#PB_Absolute)
MoveEntity(ragdolls()\legr,ragdolls()\posx+0.3,bloodygameheight-2,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\legl,ragdolls()\posx-0.3,bloodygameheight-2,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\legru,ragdolls()\posx+0.3,bloodygameheight-2.9,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\leglu,ragdolls()\posx-0.3,bloodygameheight-2.9,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\armr,ragdolls()\posx+0.6,bloodygameheight-1,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\arml,ragdolls()\posx-0.6,bloodygameheight-1,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\armru,ragdolls()\posx+0.6,bloodygameheight-2,ragdolls()\posz,#PB_Absolute)
MoveEntity(ragdolls()\armlu,ragdolls()\posx-0.6,bloodygameheight-2,ragdolls()\posz,#PB_Absolute)
Next
EndIf
If KeyboardReleased(#PB_Key_V)
Select hands
Case 0
hands=1
Case 2
hands=3
EndSelect
EndIf
If KeyboardPushed(#PB_Key_T)
ForEach ragdolls()
ApplyEntityImpulse(ragdolls()\armlu ,0,-1,0,0,-1,0,#PB_World)
ApplyEntityImpulse(ragdolls()\armru ,0,-1,0,0,-1,0,#PB_World)
ApplyEntityImpulse(ragdolls()\leglu,0,-3,0,0,-1,0,#PB_World)
ApplyEntityImpulse(ragdolls()\legru,0,-3,0,0,-1,0,#PB_World)
ApplyEntityImpulse(ragdolls()\Head ,0, 10,0,0,1,0,#PB_World)
Next
EndIf
If KeyboardPushed(#PB_Key_J)
ForEach ragdolls()
ApplyEntityImpulse(ragdolls()\Body,0,10,0)
Next
EndIf
If KeyboardReleased(#PB_Key_U)
Select dance
Case 1
dance=0
Case 0
dance=1
EndSelect
EndIf
If KeyboardPushed(#PB_Key_F)
ForEach ragdolls()
If EntityY(ragdolls()\Body)<259
ApplyEntityImpulse(ragdolls()\Body,0, 3,0,0,-10,0,#PB_World)
ApplyEntityImpulse(ragdolls()\armlu ,0, 3,0,0,-10,0,#PB_World)
ApplyEntityImpulse(ragdolls()\armru ,0, 3,0,0,-10,0,#PB_World)
ApplyEntityImpulse(ragdolls()\leglu ,0, 3,0,0,-10,0,#PB_World)
ApplyEntityImpulse(ragdolls()\legru ,0, 3,0,0,-10,0,#PB_World)
ApplyEntityImpulse(ragdolls()\Head ,0,6,0,0,0 ,0,#PB_World)
EndIf
Next
EndIf
If KeyboardPushed(#PB_Key_H)
ForEach ragdolls()
ApplyEntityImpulse(ragdolls()\armlu,0,1,0,0,-2,0,#PB_World)
ApplyEntityImpulse(ragdolls()\armru,0,1,0,0,-2,0,#PB_World)
ApplyEntityImpulse(ragdolls()\legl,0,-4,0,0,-20,0,#PB_World)
ApplyEntityImpulse(ragdolls()\legr,0,-4,0,0,-20,0,#PB_World)
ApplyEntityImpulse(ragdolls()\Head,0,5,0,0,0,0,#PB_World)
ApplyEntityImpulse(ragdolls()\Body,0,4,0,0,10,0,#PB_World)
Next
EndIf
If KeyboardPushed(#PB_Key_Add)
wg+1
WorldGravity(wg)
EndIf
If KeyboardPushed(#PB_Key_Subtract)
wg-1
WorldGravity(wg)
EndIf
If KeyboardPushed(#PB_Key_G)
ForEach ragdolls()
ApplyEntityImpulse(ragdolls()\Head ,0, 2,0)
ApplyEntityImpulse(ragdolls()\legl , 0, Random(4),0,0,-6,0,#PB_World)
ApplyEntityImpulse(ragdolls()\legr , 0, Random(4),0,0,-6,0,#PB_World)
ApplyEntityImpulse(ragdolls()\armlu , 0, Random(1),0,0,6,0,#PB_World)
ApplyEntityImpulse(ragdolls()\armru , 0, Random(1),0,0,6,0,#PB_World)
ApplyEntityImpulse(ragdolls()\Body,0,-6,0,0,0,0,#PB_World)
Next
EndIf
If KeyboardPushed(#PB_Key_Pad6)
ForEach ragdolls()
RotateEntity(ragdolls()\Head,0,10,0,#PB_Relative)
Next
EndIf
If KeyboardPushed(#PB_Key_Pad4)
ForEach ragdolls()
RotateEntity(ragdolls()\Head,0,-10,0,#PB_Relative)
Next
EndIf
If KeyboardPushed(#PB_Key_Pad1)
ForEach ragdolls()
RotateEntity(ragdolls()\Head,0,0,-5,#PB_Relative)
Next
EndIf
If KeyboardPushed(#PB_Key_Pad3)
ForEach ragdolls()
RotateEntity(ragdolls()\Head,0,0,5,#PB_Relative)
Next
EndIf
If KeyboardPushed(#PB_Key_Pad8)
ForEach ragdolls()
RotateEntity(ragdolls()\Head,-10,0,0,#PB_Relative)
Next
EndIf
If KeyboardPushed(#PB_Key_Pad2)
ForEach ragdolls()
RotateEntity(ragdolls()\Head,10,0,0,#PB_Relative)
Next
EndIf
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
RotateCamera(camera, MouseY, MouseX, 0, #PB_Relative)
MoveCamera (camera, KeyX, 0, KeyY)
;Make it Bloody
ExamineWorldCollisions(#True)
While NextWorldCollision()
If platte=FirstWorldCollisionEntity() Or platte=SecondWorldCollisionEntity()
WorldCollisionAppliedImpulse()
impy=GetY()
If impy>666
killjoints()
hands=0
EndIf
If impy>20 ; blood with heavier impulses
If impy>100
impy=100
EndIf
WorldCollisionContact()
AddElement(blood())
blood()\id=CopyEntity(kontakt,#PB_Any)
ScaleEntity(blood()\id,impy/5,1,impy/5,#PB_Relative)
blood()\time=ElapsedMilliseconds()+(impy*impy/2)
MoveEntity(blood()\id,GetX(),GetY(),GetZ(),#PB_Absolute)
EndIf
EndIf
Wend
ForEach blood()
If ElapsedMilliseconds()>blood()\time+5000
FreeEntity(blood()\id)
DeleteElement(blood())
EndIf
Next
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized", 0)
EndIf
End