Tokamak Präzision - erledigt!
Übersicht

![]() |
Uncle HoBetreff: Tokamak Präzision - erledigt! |
![]() Antworten mit Zitat ![]() |
---|---|---|
hallo,
nach einigen experinemten mit tokamak habe ich ein problem mit der präzision der berechnungen. beim folgenden beispiel sollte der BallJoint eigentlich auspendeln und bei winkel 0,0,0 stehenbleiben. tut er aber nicht. er bleibt teilweise sogar in sehr seltsamen winkelpositionen stehen die nicht senkrecht stehen (wie auf dem bild). liegt das an irgendeinem parameter den ich falsch setze oder vergesse? (so endet die schwingung) ![]() Code: [AUSKLAPPEN] Graphics3D 800, 600, 0, 2 SeedRnd MilliSecs() ; -> Cam & Light camera = CreateCamera( ) PositionEntity camera, 0, 20, -35 light = CreateLight( 2 ) ; -> Global Vars Global elapsed, ticks Global period = 1000 / 60 Global time = MilliSecs() - period ; -> Tokamak Init Const Rigid_Bodies = 200 Const Animated_Bodies = 7 TOKSIM_SetRigidBodiesCount Rigid_Bodies TOKSIM_SetAnimatedBodiesCount Animated_Bodies TOKSIM_SetRigidParticleCount 0 TOKSIM_SetControllersCount 0 TOKSIM_SetGeometriesCount Rigid_Bodies + Animated_Bodies TOKSIM_CreateSimulator( 0, -10, 0 ) ; -> Ball & Chain gBall = CreateSphere(12, gBall) EntityColor gBall, 228, 228, 228 EntityShininess gBall, 1 gChain = CreateCylinder(8, 1, gBall) PositionEntity gChain, 0, 14, 0 ScaleEntity gChain, .2, 14, .2 gLink = CreateCylinder(8, 1, gBall) ScaleEntity gLink, .4, .2, .4 PositionEntity gLink, 0, 1, 0 EntityColor gLink, 128, 255, 0 gBall_RB = TOKRB_Create() TOKRB_AddSphere gBall_RB, 2 TOKRB_SetPosition gBall_RB, 0, 5, 0 TOKRB_SetVelocity gBall_RB, Rand(1, 10), Rand(1, 10), Rand(1, 10) TOKRB_SetMass gBall_RB, 150 TOKRB_SetSphereInertiaTensor gBall_RB,1, 150 TOKRB_UpdateBoundingInfo gBall_RB TOKRB_SetAngularDamping gBall_RB, .01 TOKRB_SetLinearDamping gBall_RB, .01 TOKRB_SetCollisionID gBall_RB, 1 AlignToVector gBall, -x#, 0, -z#, 2 TOKRB_SetRotation gBall_RB, EntityPitch(gBall), EntityYaw(gBall), EntityRoll(gBall) gBallJoint = TOKJOINT_Create(1, gBall_RB, 0) TOKJOINT_SetPositionAndRotationWorld(gBallJoint, 0.0, 35.0, 0.0, 0, 0, 0) TOKJOINT_SetType(gBallJoint, 1) TOKJOINT_Enable(gBallJoint, True) TOKJOINT_SetDampingFactor gBallJoint, 1.0 ; -> Additional Meshes shadow = CreateCylinder(16, 1) ScaleEntity shadow, 1, 0.1, 1 PositionEntity shadow, 0, 0, 0 EntityColor shadow, 0, 0, 0 EntityAlpha shadow, 0.5 bullseye = CreateCylinder(16, 1) ScaleEntity bullseye, 1.5, 0.01, 1.5 PositionEntity bullseye, 0, 0.05, 0 EntityColor bullseye, 255, 0, 0 EntityFX bullseye, 1 target = CreateCylinder(16, 1) ScaleEntity target, 4, 0.01, 4 PositionEntity target, 0, 0.03, 0 EntityColor target, 255, 255, 0 EntityFX target, 1 ground = CreatePlane( ) EntityColor ground, 0, 200, 50 While Not KeyHit(1) 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 CaptureWorld If KeyHit(57) TOKRB_SetVelocity gBall_RB, Rand(1, 10), Rand(1, 10), Rand(1, 10) TOKSIM_Advance( 0.1, 1 ) PositionEntity gBall, TOKRB_GetX#(gBall_RB),TOKRB_GetY#(gBall_RB),TOKRB_GetZ#(gBall_RB) RotateEntity gBall, TOKRB_GetPitch#(gBall_RB),TOKRB_GetYaw#(gBall_RB),TOKRB_GetRoll#(gBall_RB),False PositionEntity shadow, TOKRB_GetX#(gBall_RB), 0.1 ,TOKRB_GetZ#(gBall_RB) Next UpdateWorld( ) RenderWorld( tween# ) Text 10, 10, "PhysicsTime: " + TOKSIM_GetPhysicsTime() Text 10, 30, "APitch: " + TOKJOINT_GetFrameAPitch( gBallJoint ) Text 10, 40, "AYaw: " + TOKJOINT_GetFrameAYaw( gBallJoint ) Text 10, 50, "ARoll: " + TOKJOINT_GetFrameARoll( gBallJoint ) Flip False Wend TOKSIM_DestroySimulator() End |
||
___________________________________
GUNG HO |
- Zuletzt bearbeitet von Uncle Ho am Mo, Apr 24, 2006 15:10, insgesamt einmal bearbeitet
![]() |
Jan_Ehemaliger Admin |
![]() Antworten mit Zitat ![]() |
---|---|---|
Also, bei mir klappt das einwandfrei.
TOKSIM_Advance( 0.1, 1 ) eventuell die Substeps etwas höher stellen. |
||
between angels and insects |
![]() |
Uncle Ho |
![]() Antworten mit Zitat ![]() |
---|---|---|
habe die substeps nun mal höher gestellt.
das gleiche problem. bei mir endet die die schwingung zb bei: APitch -0.8757 AYaw 2.6490 ARoll 4.1922 steht also total schräg im raum. bei dir klappt das immer? ps: mit <space> kann man erneut schwingen |
||
___________________________________
GUNG HO |
![]() |
Jan_Ehemaliger Admin |
![]() Antworten mit Zitat ![]() |
---|---|---|
ja,
Intel p4 endet ungefähr bei 0.01 - 0.3 also, nur minimal scheif. |
||
between angels and insects |
![]() |
Uncle Ho |
![]() Antworten mit Zitat ![]() |
---|---|---|
Danke für den test.
habe die lösung gerade gefunden ![]() man muss dem RigidBody noch einen parameter mitgeben der tokamak sag wann der Körper als schlafend angesehen wird und somit nicht mehr aktualisiert wird. der wert muss hier also hochgestellt werden damit es wirklich präziser arbeitet. Code: [AUSKLAPPEN] TOKRB_SetSleepingParameter gBall_RB, 0.001
den wert kann man höher stellen, muss aber sicherlich mit vorsicht gemacht werden denn das geht natürlich auf die performance. it's not a bug - it's a feature ![]() |
||
___________________________________
GUNG HO |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group