Rotate Object Newbie Question
Blitz3D Forums/Blitz3D Beginners Area/Rotate Object Newbie Question
| ||
I have several meshes inside a 3DS. I need to rotate a mesh in your own Y axis, not relative to the parent or world. Please, how to do that? Creating a pivot? |
| ||
By Y-axis I assume you mean Yaw axis.turnentity MyEntity, 0 , Angle, 0 , 1 OR rotateentity entity, entitypitch( entity ) , entityyaw( entity ) + Angle , entityroll( entity ), 1 The first is best as will avoid gimbal lock as uses quarternions internally. Remember the global paramater if it's a child entity. |
| ||
Iīm doing this, but the rotation is relative to the global parent, not the object it self, that is the question. My object is a 3DS Mouth, with 32 teeth. I need to rotate each tooth in their own axis, not relative to the axis of the mouth. |
| ||
So you are already using the GLOBAL parameter for turnentity? |
| ||
I have tried BOTH. |
| ||
Well that should have worked just fine ... can you show a picture of what you mean as maybe I'm not understanding you. |
| ||
I have tried with a single mesh or a primitive. Itīs working. Itīs not working with child meshes. The object is orbiting the parent object, not rotating in its own axis. The ideia is rotate the tooth to simulate a orthodontic treatment. |
| ||
Well, it looks more like your mesh is set up incorrectly and the teeth are not centered on their own axis of rotation. For example - this works : Graphics3D 1024,768,32,2 camera = CreateCamera() PositionEntity camera, 0,0,-50 AmbientLight 128,128,128 light = CreateLight() : RotateEntity light, 30,-45,0 gum = CreateCube() EntityColor gum, 250,200,200 EntityFX gum, 4 tooth = CreateCube() ScaleMesh tooth, .1, 1, .1 EntityFX tooth, 4 For l# = -1 To 1 Step .5 copy = CopyEntity( tooth , gum ) ScaleEntity copy, 1,Rnd(1,2),1 PositionEntity copy, l*.75, -1,0 RotateEntity copy, 0 , Rand(-180,180), 0 Next FreeEntity tooth ScaleEntity gum, 10,2,2 While Not KeyHit(1) For c = 1 To CountChildren( gum ) TurnEntity GetChild( gum, c ) , 0 , 1 , 0 Next RenderWorld() Flip Wend |
| ||
Thanks a lot Stevie. Yes, I think itīs is my 3DS not correct. Thank you again. |