DevilPhysic's - Mesh Impulse
Übersicht

![]() |
N0XBetreff: DevilPhysic's - Mesh Impulse |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich habe die Devil's Physic Engine in mein Game eingebaut aber warum funktioniert die Impuls-Sache nur manchmal?
Code: [AUSKLAPPEN] Include "SampleFunctions.bb"
Const BALL=1,TISCH=2 Global qx=0,wForce#=4,stoss,weiss=1 Graphics3D 1680,1050,32,1 SetBuffer BackBuffer() SeedRnd MilliSecs() Cam = CreateCamera() PositionEntity cam,-100,200,-300 RotateEntity cam,20,0,-7 TurnEntity cam,0,-20,0 CameraRange cam,1,1500 room = LoadMesh("models\room.3ds") table = LoadMesh("models\table.3ds") Global queue = LoadMesh("models\queue.3ds") InitPhysics() SetPhysicCamera(Cam, 1.5, 1.5, 1, True) ;---------------------------------------------------------------------| ;LICHT light1 = CreateLight() PositionEntity light1,0,140,0 li=CreateCone() ScaleEntity li,80,80,80 PositionEntity li,0,140,0 EntityColor li,255,255,128 EntityAlpha li,.03 EntityFX li,1+16 li2=CreateCone() ScaleEntity li2,80,80,80 PositionEntity li2,-115,140,0 EntityColor li2,255,255,128 EntityAlpha li2,.03 EntityFX li2,1+16 li3=CreateCone() ScaleEntity li3,80,80,80 PositionEntity li3,110,140,0 EntityColor li3,255,255,128 EntityAlpha li3,.03 EntityFX li3,1+16 Include "Includes\sphere.bb" SetBallsToStart() ;SetPhysicGravity(8) ;---------------------------------------------------------------------| ;EntityType table,TISCH c = CreateCube() ScaleEntity c,170,1,100 SetStaticPhysicMesh(c,"Cube",0,61.2,0) c2 = CreateCube():HideEntity c2 ScaleEntity c2,10,5,90 SetStaticPhysicMesh(c2,"Cube",-165,67,0) c3 = CreateCube():HideEntity c3 ScaleEntity c3,10,5,90 SetStaticPhysicMesh(c3,"Cube",171.1,67,0) c4 = CreateCube():HideEntity c4 ScaleEntity c4,160,5,10 SetStaticPhysicMesh(c4,"Cube",0,67,-89.1) c5 = CreateCube():HideEntity c5 ScaleEntity c5,160,5,10 SetStaticPhysicMesh(c5,"Cube",0,67,94.3) ;SetStaticPhysicMesh(room,"Cube",0,0,0) ;---------------------------------------------------------------------| ;MENU ;---------------------------------------------------------------------| timer = CreateTimer(60) ;Collisions BALL,TISCH,2,2 ;Collisions BALL,BALL,2,2 While Not KeyHit(1) WaitTimer(timer) Cls updBalls() pitch# = MinMax(EntityPitch(cam)+MouseYSpeed()/1.0,-89,89) yaw# = EntityYaw(cam)-MouseXSpeed()/1.0 RotateEntity(cam,pitch#,yaw#,0) MoveMouse ((GraphicsWidth())/2)-6,((GraphicsHeight())/2)-9.5 PositionEntity queue,qx,78,0 UpdateWorld() RenderWorld() UpdatePhysics(0.1) Flip 0 Wend FreePhysics() End ;---------------------------------------------------------------------| Function UpdateSample() End Function Function InRange(X1#,Y1#,X2#,Y2#,Range) Return ((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2)) End Function Function updBalls() If KeyHit(57) Then qx=-210 RotateEntity queue,0,180,7 PositionEntity cam,-160,83,0 RotateEntity cam,6,-90,0 For k.kugel = Each kugel ;SetPhysicMeshPosition(white\ode,-100,67,0) ApplyPhysicMeshImpulse(white\ode,20,0,0) Next EndIf If KeyHit(28) Then SetBallsToStart() If MouseDown(1) Then qx=qx-MouseYSpeed() If qx<-230 Then qx=-230 If qx>-202 Then qx=-202 EndIf ;If KeyDown(17) Then MoveEntity cam,0,0,8 ;If KeyDown(31) Then MoveEntity cam,0,0,-8 ;If KeyDown(30) Then MoveEntity cam,-8,0,0 ;If KeyDown(32) Then MoveEntity cam,8,0,0 End Function Function MinMax#(value#, min#, max#) If value < min Then Return min ElseIf value > max Then Return max Else Return value EndIf End Function Hoffe es ist etwas was sich beheben lässt... Mfg, N0X //ALT: Hey! Ich habe mal eine Frage zu den Mesh Impuls Befehlen von der Devil's Physic Engine. Und zwar, was bedeutet ApplyMeshImpulse() und was SetMeshImpulse()? Bei mir setzen diese Befehle leider manchmal aus und da ich mir nicht sicher bin was genau die Befehle machen, frage ich. Mfg, N0X //EDIT: Hat sich geklärt, lag daran, dass ich die Camera mit MoveEntity bewegt hab. Trotzdem komisch... //EDIT2: Problem bleibt doch! Irgendwie klappt ApplyMeshImpulse() nur mit einem Wert von z.B. 30 oder 50 aber mit 40 dann wieder nicht. Warum?! |
||
Projekte: |Tibario| http://www.blitzforum.de/worklogs/325/ | 5% |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group