Rotation using AddEntity not working


#1

Hi,
I am attempting to rotate a model using AddEntity().

I’ve tried both ‘rotation’ and’ localRotation’ and they both flip the Y 180 degrees based on my code below. I want to rotate the object only 90 degrees.

Also, they both make the object super big, then eventually render it properly. Sometimes I have to shutdown and restart the Interface to see the object in place.

var Rotation = { x: 0, y: -90, z: 0, w: 0 };

        var properties = {  
            type: "Model",
            modelURL: house,
            position: newCoord,
            rotation: Rotation,
            //localRotation: localRotation,
            dimensions: { x: 1, y: 1, z: 1 },
            collisionsWillMove: true,
            shapeType: 'static-mesh'
        };
        entityID = Entities.addEntity(properties);

#2

A rotation is a Quat (quaternion) with all x, y, x, w, values being between 0.0 and 1.0.

What you want is…

var Rotation = Quat.fromPitchYawRollDegrees(0, -90, 0);

And for interest…

print(JSON.stringify(Rotation));
// {"x":0,"y":-0.7071067690849304,"z":0,"w":0.7071067690849304}

#3

Thank you! Makes sense now :))


#4

Quarternions make sense??? Bless you.