Tokamak RagDoll
Übersicht

[Nasty]Betreff: Tokamak RagDoll |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hi Leutz
Hab mich mal mit Tokamak beschäftigt und ein RagDoll Männchen gebastelt. Ist nicht perfekt (die Gelenke in den Armen haben keine Begrenzung) aber es sieht schon mal nicht schlecht aus. Der rest vom Körper hat nach meiner auffassung nach "realistische" bewegungen. Kleines problem: Wenn das Männchen auf dem Boden liegt, kann es sein, dass es von selbst davon rutscht. Steuerung: MausRad = Auswahl Körperteil (Transparent) MausTasteLinks = Schlag auf ausgewähltes K.Teil MausTasteRechts= Körper wieder an "die Decke hefte" Leertaste = Körper neu Laden Code: [AUSKLAPPEN] Graphics3D 1024,768,16,1 SetBuffer BackBuffer() Dim obj(20) Dim rb(20) ;PhysicEngine Const Rigid_Bodies=20,Animated_Bodies=5,Rigid_Particles=1 TOKSIM_SetRigidBodiesCount Rigid_Bodies TOKSIM_SetAnimatedBodiesCount Animated_Bodies TOKSIM_SetRigidParticleCount Rigid_Particles TOKSIM_SetControllersCount 0 TOKSIM_SetGeometriesCount Rigid_bodies+Animated_Bodies TOKSIM_CreateSimulator(0,-10,0) FPS=60 ;Txt ;TxtHead=LoadTexture("Txt\Head.bmp") ;TxtGround=LoadTexture("Txt\Logo.bmp") Gosub newbody ;Cam cam=CreateCamera() PositionEntity cam,0,15,-45 AmbientLight 255,255,255 cam2=CreateCamera() PositionEntity cam2,15,15,0 RotateEntity cam2,0,90,0 ;World ground=CreateCube() EntityColor ground,100,100,100 ;EntityTexture ground,TxtGround ScaleEntity ground,40,1,40 PositionEntity ground,0,-5,0 aground=TOKAB_Create() TOKAB_AddBox(aground,80,2,80) TOKAB_SetPosition aground,0,-5,0 rig=11 ;Anzahl RigidBodys (Körperteile/Bullet) aus=1 j=CreateSphere() ScaleEntity j,.5,.5,.5 PositionEntity j,0,22,0 period=1000/FPS time=MilliSecs()-period imptime=MilliSecs() ;****************************************** While Not KeyHit(1) CameraViewport cam2,0,0,200,200 Repeat elapsed=MilliSecs()-time Until elapsed ticks=elapsed/period tween#=Float(elapsed Mod period)/Float(period) For k=1 To ticks time=time+period If k=ticks Then CaptureWorld For i=1 To rig If aus=i Then EntityAlpha obj(i),.5 Else EntityAlpha obj(i),1 PositionEntity obj(i),TOKRB_GetX#(rb(i)),TOKRB_GetY#(rb(i)),TOKRB_GetZ#(rb(i)) RotateEntity obj(i),TOKRB_GetPitch#(rb(i)),TOKRB_GetYaw#(rb(i)),TOKRB_GetRoll#(rb(i)),False Next EndIf TOKSIM_Advance((2.0)/FPS,2) UpdateWorld Next If MouseHit(1) Then TOKRB_ApplyImpulse rb(aus),0,80,100:z=0 If MouseHit(2) Then z=1-z ;PointEntity cam,obj(1) Select MouseZSpeed () Case -1 aus=aus+1 If aus>11 Then aus=1 Case 0 aus=aus Case 1 aus=aus-1 If aus<1 Then aus=11 End Select If KeyHit(57) Then For i=1 To rig FreeEntity obj(i) TOKRB_Free rb(i) Next Gosub newbody EndIf TOKJOINT_Enable(joint,z) RenderWorld Text 1000,0,z Text 900,0,aus Flip Wend End .NewBody ;RagDoll Körper ;Kopf obj(1)=CreateSphere() EntityColor obj(1),200,250,0 ScaleEntity obj(1),2,2,2 ;EntityTexture obj(1),TxtHead rb(1)=TOKRB_Create() TOKRB_AddSphere(rb(1),4) TOKRB_SetPosition rb(1),0,20,0 TOKRB_CollideConnected rb(1),True TOKRB_SetLinearDamping rb(1),0.005 TOKRB_SetAngularDamping rb(1),0.02 ;TOKRB_SetMass rb(1),1 ;Hals obj(2)=CreateCylinder() EntityColor obj(2),245,238,183 ScaleEntity obj(2),.5,1,.5 rb(2)=TOKRB_Create() TOKRB_AddCylinder(rb(2),1,2) TOKRB_SetPosition rb(2),0,17.5,0 TOKRB_CollideConnected rb(2),True TOKRB_SetLinearDamping rb(2),0.005 TOKRB_SetAngularDamping rb(2),0.02 ;TOKRB_SetMass rb(2),.1 ;Körper obj(3)=CreateCube() EntityColor obj(3),255,0,0 ScaleEntity obj(3),3,4,1.1 rb(3)=TOKRB_Create() TOKRB_AddBox(rb(3),6,8,2.2) TOKRB_SetPosition rb(3),0,13.5,0 TOKRB_CollideConnected rb(3),True TOKRB_SetLinearDamping rb(3),0.005 TOKRB_SetAngularDamping rb(3),0.02 ;TOKRB_SetMass rb(3),5 ;Linker Ober Arm obj(4)=CreateCylinder() EntityColor obj(4),0,0,255 ScaleEntity obj(4),1,2,1 rb(4)=TOKRB_Create() TOKRB_AddCylinder rb(4),2,4 TOKRB_SetPosition rb(4),-4.5,16.5,0 TOKRB_SetRotation rb(4),0,0,90 TOKRB_CollideConnected rb(4),True TOKRB_SetLinearDamping rb(4),0.005 TOKRB_SetAngularDamping rb(4),0.02 ;TOKRB_SetMass rb(4),1 ;Rechter Ober Arm obj(5)=CreateCylinder() EntityColor obj(5),0,0,255 ScaleEntity obj(5),1,2,1 rb(5)=TOKRB_Create() TOKRB_AddCylinder rb(5),2,4 TOKRB_SetPosition rb(5),4.5,16.5,0 TOKRB_SetRotation rb(5),0,0,90 TOKRB_CollideConnected rb(5),True TOKRB_SetLinearDamping rb(5),0.005 TOKRB_SetAngularDamping rb(5),0.02 ;TOKRB_SetMass rb(5),1 ;Linker Unter Arm obj(6)=CreateCube() EntityColor obj(6),0,0,200 ScaleEntity obj(6),2.5,1,1 rb(6)=TOKRB_Create() TOKRB_AddBox rb(6),5,2,2 TOKRB_SetPosition rb(6),8.5,16.5,0 TOKRB_CollideConnected rb(6),True TOKRB_SetLinearDamping rb(6),0.005 TOKRB_SetAngularDamping rb(6),0.02 ;TOKRB_SetMass rb(6),1 ;Rechter Unter Arm obj(7)=CreateCube() EntityColor obj(7),0,0,200 ScaleEntity obj(7),2.5,1,1 rb(7)=TOKRB_Create() TOKRB_AddBox rb(7),5,2,2 TOKRB_SetPosition rb(7),-8.5,16.5,0 TOKRB_CollideConnected rb(7),True TOKRB_SetLinearDamping rb(7),0.005 TOKRB_SetAngularDamping rb(7),0.02 ;TOKRB_SetMass rb(6),1 ;Linker Oberschenkel obj(8)=CreateCylinder() EntityColor obj(8),0,255,0 ScaleEntity obj(8),1.5,3,1.5 rb(8)=TOKRB_Create() TOKRB_AddCylinder rb(8),3,6 TOKRB_SetPosition rb(8),1.75,7,0 TOKRB_CollideConnected rb(8),True TOKRB_SetLinearDamping rb(8),0.005 TOKRB_SetAngularDamping rb(8),0.02 ;TOKRB_SetMass rb(8),2 ;Rechter Oberschenkel obj(9)=CreateCylinder() EntityColor obj(9),0,255,0 ScaleEntity obj(9),1.5,3,1.5 rb(9)=TOKRB_Create() TOKRB_AddCylinder rb(9),3,6 TOKRB_SetPosition rb(9),-1.75,7,0 TOKRB_CollideConnected rb(9),True TOKRB_SetLinearDamping rb(9),0.005 TOKRB_SetAngularDamping rb(9),0.02 ;TOKRB_SetMass rb(9),2 ;Rechter Unterschenkel obj(10)=CreateCube() EntityColor obj(10),0,200,0 ScaleEntity obj(10),1.5,4,1.5 rb(10)=TOKRB_Create() TOKRB_AddBox rb(10),3,8,3 TOKRB_SetPosition rb(10),-1.75,1,0 TOKRB_CollideConnected rb(10),True TOKRB_SetLinearDamping rb(10),0.005 TOKRB_SetAngularDamping rb(10),0.02 ;TOKRB_SetMass rb(10),1.5 ;Linker Unterschenkel obj(11)=CreateCube() EntityColor obj(11),0,200,0 ScaleEntity obj(11),1.5,4,1.5 rb(11)=TOKRB_Create() TOKRB_AddBox rb(11),3,8,3 TOKRB_SetPosition rb(11),1.75,1,0 TOKRB_CollideConnected rb(11),True TOKRB_SetLinearDamping rb(11),0.005 TOKRB_SetAngularDamping rb(11),0.02 ;TOKRB_SetMass rb(11),1.5 ;Joints ;Kopf-Decke joint=TOKJOINT_Create(1,rb(1),0) TOKJOINT_SetPositionAndRotationWorld joint,0,22,0,0,0,90 TOKJOINT_SetType joint,3 TOKJOINT_Enable(joint,True) z=1 ;Kopf-Hals joint1=TOKJOINT_Create(2,rb(1),rb(2)) TOKJOINT_SetPositionAndRotationWorld joint1,0,18,0,0,0,90 TOKJOINT_SetType joint1,3 TOKJOINT_Enable(joint1,True) ;Hals-Körper joint2=TOKJOINT_Create(2,rb(2),rb(3)) TOKJOINT_SetPositionAndRotationWorld joint2,0,17,0,0,0,90 TOKJOINT_SetType joint2,1 TOKJOINT_SetLowerLimit2 joint2,3.14*0.3 TOKJOINT_SetUpperLimit2 joint2,3.14*0.0 TOKJOINT_EnableLimit2(joint2,True) TOKJOINT_Enable(joint2,True) ;Körper-Rechter Ober Arm joint3=TOKJOINT_Create(2,rb(3),rb(4)) TOKJOINT_SetPositionAndRotationWorld joint3,-3,16.5,0,0,0,90 TOKJOINT_SetType joint3,1 TOKJOINT_SetLowerLimit2 joint3,-3.14*0.01 TOKJOINT_SetUpperLimit2 joint3,3.14*0.01 ;TOKJOINT_EnableLimit2(joint3,True) TOKJOINT_Enable(joint3,True) ;Körper-Linker Ober Arm joint4=TOKJOINT_Create(2,rb(3),rb(5)) TOKJOINT_SetPositionAndRotationWorld joint4,3,16.5,0,0,0,90 TOKJOINT_SetType joint4,1 TOKJOINT_SetLowerLimit2 joint4,-3.14*0.01 TOKJOINT_SetUpperLimit2 joint4,3.14*0.10 ;TOKJOINT_EnableLimit2(joint4,True) TOKJOINT_Enable(joint4,True) ;Linker Ober Arm-Linker Unter Arm joint5=TOKJOINT_Create(2,rb(5),rb(6)) TOKJOINT_SetPositionAndRotationWorld joint5,6,16.5,0,0,0,180 TOKJOINT_SetType joint5,3 TOKJOINT_SetLowerLimit joint5,-3.14*0.01 TOKJOINT_SetUpperLimit joint5,3.14*0.5 ;TOKJOINT_EnableLimit(joint5,True) TOKJOINT_SetLowerLimit2 joint5,3.14*0.01 TOKJOINT_SetUpperLimit2 joint5,3.14*0.01 ;TOKJOINT_EnableLimit2(joint5,True) TOKJOINT_Enable(joint5,True) ;Rechter Ober Arm-Rechter Unter Arm joint6=TOKJOINT_Create(2,rb(4),rb(7)) TOKJOINT_SetPositionAndRotationWorld joint6,-6,16.5,0,0,0,0 TOKJOINT_SetType joint6,3 TOKJOINT_SetLowerLimit joint6,-3.14*0.01 TOKJOINT_SetUpperLimit joint6,3.14*0.5 ;TOKJOINT_EnableLimit(joint6,True) TOKJOINT_SetLowerLimit2 joint6,3.14*0.01 TOKJOINT_SetUpperLimit2 joint6,3.14*0.01 ;TOKJOINT_EnableLimit2(joint6,True) TOKJOINT_Enable(joint6,True) ;Körper-Linker Oberschenkel joint7=TOKJOINT_Create(2,rb(3),rb(8)) TOKJOINT_SetPositionAndRotationWorld joint7,1.75,10,0,0,0,90 TOKJOINT_SetType joint7,1 TOKJOINT_SetLowerLimit joint7,-3.14*0.0 TOKJOINT_SetUpperLimit joint7,3.14*0.6 TOKJOINT_EnableLimit(joint7,True) TOKJOINT_SetLowerLimit2 joint7,-3.14*0.0 TOKJOINT_SetUpperLimit2 joint7,3.14*0.0 TOKJOINT_EnableLimit2(joint7,True) TOKJOINT_Enable(joint7,True) ;Körper-Rechter Oberschenkel joint8=TOKJOINT_Create(2,rb(3),rb(9)) TOKJOINT_SetPositionAndRotationWorld joint8,-1.75,10,0,0,0,90 TOKJOINT_SetType joint8,1 TOKJOINT_SetLowerLimit joint8,-3.14*0.0 TOKJOINT_SetUpperLimit joint8,3.14*0.6 TOKJOINT_EnableLimit(joint8,True) TOKJOINT_SetLowerLimit2 joint8,-3.14*0.0 TOKJOINT_SetUpperLimit2 joint8,3.14*0.0 TOKJOINT_EnableLimit2(joint8,True) TOKJOINT_Enable(joint8,True) ;Rechter Oberschenkel-Rechter Unterschenkel joint9=TOKJOINT_Create(2,rb(9),rb(10)) TOKJOINT_SetPositionAndRotationWorld joint9,-1.75,4.5,0,0,0,90 TOKJOINT_SetType joint9,3 TOKJOINT_SetLowerLimit joint9,-3.14*0.8 TOKJOINT_SetUpperLimit joint9,3.14*0.01 TOKJOINT_EnableLimit(joint9,True) TOKJOINT_SetLowerLimit2 joint9,-3.14*0.0 TOKJOINT_SetUpperLimit2 joint9,3.14*0.0 TOKJOINT_EnableLimit2(joint9,True) TOKJOINT_Enable(joint9,True) ;Linker Oberschenkel-Linker Unterschenkel joint10=TOKJOINT_Create(2,rb(8),rb(11)) TOKJOINT_SetPositionAndRotationWorld joint10,1.75,4.5,0,0,0,90 TOKJOINT_SetType joint10,3 TOKJOINT_SetLowerLimit joint10,-3.14*0.8 TOKJOINT_SetUpperLimit joint10,3.14*0.01 TOKJOINT_EnableLimit(joint10,True) TOKJOINT_SetLowerLimit2 joint10,-3.14*0.0 TOKJOINT_SetUpperLimit2 joint10,3.14*0.0 TOKJOINT_EnableLimit2(joint10,True) TOKJOINT_Enable(joint10,True) Return ps: sorry für evtl. Rechtschreibfehler pps: sorry für evtl. falsche Bedienung des Forums (mein erster Beitrag) ppps: fals jemand verwendung hat (verbesserungen) bitte auch posten. Würd mich freun... |
||
http://www.monstersgame.de/?ac=vid&vid=106762 |
![]() |
bruZard |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich glaube nicht dass das was im BlitzMax Code-Archive zu suchen hat.
VERSCHOBEN |
||
PIV 2,4GHz - 1GB DDR 333 - ATI Radeon9600 - WinXP - DX9.0c - BMax 1.14 - B3D 1.91 - 1280x1024x32
User posted image |
![]() |
skatanist |
![]() Antworten mit Zitat ![]() |
---|---|---|
ob ein Körper rutscht oder nicht, lässt sich in Tokamak einstellen. Dazu gibt man jedem Körper einen MaterialIndex (mit TOKGEOM_SetMaterialIndex, ist standardmäßig immer auf 0!)
Dann kann man die Eigenschaften des Materials festlegen: TOKSIM_SetMaterial(Index%,Friction#,Restitution#) (steht alles in der Doku) wenn du also bei deinem Code nach TOKSIM_CreateSimulator(0,-10,0) zB das hier einfügst: TOKSIM_SetMaterial(0,1,0.3) besteht zwischen allen Körpern eine größere Reibung (hier: 1 ), wodurch sie nicht so viel rutschen ![]() Ist aber besser den RigidBodys individuelle Materials zuzuweisen, da dein boden ja zB vielleicht mit anderen Objecten anders reagieren soll! Achja: mach vil selbst noch einen Thread auf, aber wie kann man am besten Testen, ob zB ein Objekt auf einem anderen steht (für das springen )? Mit 'nem Sensor ist das alles sehr ungenau... Und wie kann man das machen, das man bei nem Hügel nicht runterrutscht, aber wenn man gegen eine Wand springt, nicht an dieser festhängt (bzw. langsam runter rutscht)? Habe mit solchen grundlegenden Sachen noch einige Probleme...vielleicht kann man da mal erfahrungen austauschen? |
||
![]() |
TheRealSephiroth |
![]() Antworten mit Zitat ![]() |
---|---|---|
wo krieg ich dieses tokamak? | ||
![]() |
skatanist |
![]() Antworten mit Zitat ![]() |
---|---|---|
Tokamak: www.tokamakphysics.com
Wrapper für B3d: www.freewebs.com/sweenie/ Das hat mich ganze 10sek meines Lebens gekostet (google)! Benutz nextes ma google bevor du fragst...manche leute hier im forum sehen das garnicht gern... ![]() |
||
[Nasty] |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Cool! Danke skatanist.
jetzt is es schon viel besser. Würd mich freun wenn wir uns austauschen könnten. Hab zwar noch nicht sooooo viel erfahrung mit Tok, aber ich klemm mich dahinter. Bis demnächst |
||
http://www.monstersgame.de/?ac=vid&vid=106762 |
mayr_alex |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hey do loos.. du bist blitzmax und nicht 3D
BLITZMAX gehört nicht zu blitz3D |
||
Wer nicht proggt ist selber schuld!!!
My firminal page: www.nimroadsoftwares.at.tc |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group