Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For a rubix cube scenario, in addition to the quat you already have, you would need a quaternion for each smaller cube. these smaller quats represent the orientation difference between them and the quat for the entire batch (the one you currently have). Think hierarchy structure here not unlike a bone sys. When you want to rotate only a few cubes (say, all on the left side) you would only multiply a rotation quat to those specific smaller cube's quats, the others don't rotate.</p> <p>Then, for drawing, you create the final orientation quat by concatenating the small cube's quat with the big cube's quat. Do that for each small cube.</p> <p>You will need the same structure for vector3s representing the positions of all the smaller cubes too.</p> <p>So, let's say you have a class called SmallCube and have instantiated it 8 times. It holds a quat and a Vector3 (for position).</p> <p>Assume the cubes are laid out around the world origin &amp; you only want to rotate the upper ones.</p> <pre><code>Foreach(smallCube sc in smallCubes) { if(sc.Position.Y &gt; 0.1f) { Quaternion addRot = Quaternion.CreateFromAxisAngle(Vector3.Up, MathHelper.ToRadians(90)); sc.quat *= addRot sc.Position = Vector3.Transform(sc.Position, addRot); } } </code></pre> <p>Using Quaternions for this as opposed to Matrices has an additional benefit. You can use the built in Quaternion.Dot() method to test for solve. If all small cube orientations are the same, all colors must be lined up. When this occurs, all dot product will be 1.0f. There is no equivelent capability in matrices.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload