6.8 C
New York
Thursday, April 17, 2025

transformation – Iterative Rotation, Translation, and Scale Round Pivot


I am coding a VR utility that enables the consumer to level the controller at an object (there is a “laser” the extends from the entrance of the controller and is utilized in hit testing) and alter its place, orientation, and scale. When pointing at an object, the set off permits the consumer to pull the thing across the room, left or proper on the joystick causes the thing to rotate round its native y-axis, and up or down on the joystick adjusts scale (across the level on the thing the place the laser hits).

In isolation, I’m able to get the entire operations to work accurately. Nevertheless, after I try to mix all of them or have a number of consecutive operations issues go flawed. For instance, if I scale the thing, it then does not monitor with the laser when translating. Or after I translate the thing, it not rotates across the heart of the thing or scales across the level that the laser hits.

My present strategy is that this:

On every replace:
   if first replace:
      Save the objects present remodel
      Save the hit location (the place on the thing the laser hit)
   Create a remodel for the present operation (i.e. if scaling, translate the hit level to the origin, alter the dimensions, after which translate again to the hit level)
   Multiply the earlier remodel by the brand new remodel, and apply it to the thing

I really feel like I am basically misunderstanding how one can iteratively apply transformations. Is that this the proper strategy? Or do I must hold monitor of separate translations/rotations/scales and mix them on the finish?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles