pivot rotate
Blitz3D Forums/Blitz3D Programming/pivot rotate
| ||
hi i rotate a mesh with over a pivot with entityparent after rotating i reset the pivot to original x,y,z now i will make a new rotate but the mesh come back to the old position. hmm comments ? |
| ||
Any code to demonstrate your problme, as i can't quite understand what your saying :) |
| ||
Graphics3D 800,600,32,1 HidePointer SetBuffer BackBuffer() light = CreateLight() camera = CreateCamera() PositionEntity camera,0,5,-6 zeiger = CreateCone() ScaleEntity zeiger ,.2,2.6,.2 TurnEntity zeiger,180,0,0 EntityColor zeiger,255,111,111 all = CreateSphere() ball = CreateSphere() pivot = CreatePivot() boden = CreateCube():ScaleEntity boden,1,1,2 PositionEntity boden ,0,-1,0 EntityFX boden,33 EntityColor boden,222,222,111 PositionEntity pivot,0,0,0 ScaleEntity all,50,50,50 FlipMesh all ScaleEntity ball,.25,.25,.25 PositionEntity ball,0,0,0 EntityColor ball,111,111,111 While Not KeyHit(1) EntityParent boden,pivot,1 If KeyHit(200) Then rauf =rauf +1 If rauf = 4 Then rauf = 0 For r= 1 To 90 TurnEntity boden,-1,0,0 RenderWorld() Flip(0) Next End If If KeyHit(208) Then If rauf = 0 Then rauf = 4 rauf = rauf -1 For r= 1 To 90 TurnEntity boden,1,0,0 RenderWorld() Flip(0) Next End If If KeyHit(205) Then rechts = rechts+1 If rechts = 4 Then rechts =0 For r= 1 To 90 If rauf = 0 Or rauf = 2 Then TurnEntity boden,0,1,0 If rauf = 1 Then TurnEntity boden,0,0,-1 RenderWorld() Flip(0) Next End If If KeyHit(203) Then If rechts = 0 Then rechts = 4 rechts = rechts-1 For r= 1 To 90 If rauf = 0 Or rauf = 2 Then TurnEntity boden,0,-1,0 If rauf = 1 Then TurnEntity boden,0,0,1 RenderWorld() Flip(0) Next End If PointEntity camera,ball PositionEntity zeiger,EntityX(ball),EntityY(ball)-2,EntityZ(ball) PositionEntity pivot,EntityX(ball),EntityY(ball)-2,EntityZ(ball) RenderWorld() Color 55,55,55 Text 10,10,rauf+" "+runter+" "+rechts+" "+links + " "+ EntityX(boden) Flip() Wend WaitKey() End after some rotates the directions not right anymore because the vectores are changed ! |
| ||
Ok, um, before i help with your problem, you only need renderworld in Once per loop, unless you are doing some fancy screen effect, which it doesn't look like you doing. Calling it several times per loop could cause big slow downs. I'll try and restructure your code, and find your problem. :) |
| ||
Hmmm... i'm still not sure what you mean. What is it you want to happen? And what is it that is happening? |
| ||
OK first this is only a demo code not optimized. the renderwold is because you will see the rotate steps such like a animation after the rotate to the small side from the mesh use the left or right key to rotate . now i will press key up but the mesh rotate in a wrong way (not forward) now i mean i must use reset the pivot axis or iam wrong thx |
| ||
OH! Right. That's to do with the way it rotates.Look at it in your head. You rotate the block on the x axis, so it is standing upright. The axises go with the rotations, so the x axis gets rotated round to the y axises position. |
| ||
true and whats why i need "static" xyz axes |
| ||
Wouldn't TurnEntity with the 'global' parameter do that? TurnEntity boden,1,0,0,true |
| ||
yes ;) iam a blind man |