mathematics – Rotate quaternion around plane normal

How can one rotate a quaternion so that the rotation is around a plane normal?

A graphic/diagram I made below gives more detail about what exactly I am implying. Note that the tip of the quaternions in the diagram are that of the quaternions local, upwards direction, symbolizing roll (the quaternion’s w component).

Rotate quaternion around plane normal

English describing the diagram:

The rotation is around plane normal (vector) N with amount θ. The global axes are X, Y, and Z (Y is up). The plane normal and quaternion are both in global space. Notice how the beginning and end of the operation does not use any reference to the global axes, only the plane.

The angle between the start quaternion (q) and end quaternion (q’) and the plane is equal (a = a’). If you were to draw lines from the tips of the quaternions to the plane, the angles of intersection would be equal. In other words, the roll of the quaternions are preserved in relation to that of the plane.

c# – Is it possible to work out rotate in degrees per second based on this rotate logic?

I have this code to rotate an object towards another at a given speed.

    /// <summary>
    /// Rotate towards the target.
    /// </summary>
    /// <param name="lookPosition"></param>
    private void RotateTowardsTarget(Vector3 lookPosition)
    {
        // Determine which direction to rotate towards
        Vector3 targetDirection = lookPosition - transform.position;

        // The step size is equal to speed times frame time.
        float singleStep = weaponRotationSpeed * Time.deltaTime;

        // Rotate the forward vector towards the target direction by one step
        Vector3 newDirection =
            Vector3.RotateTowards(turretYRotation.transform.forward, targetDirection, singleStep, 0.0f);

        // Draw a ray pointing at our target in
        //Debug.DrawRay(turretYRotation.transform.position, newDirection, Color.red, 3);

        newDirection.y = 0;
        // Calculate a rotation a step closer to the target and applies rotation to this object
        turretYRotation.transform.rotation = Quaternion.LookRotation(newDirection);
    }

And I’d like to convert this to a “Degrees per second” to give the user useful feedback on how quickly it rotates. Is there a formulae I can apply to work it out?

node.js – iPhone images rotate 90 degrees when using cloudinary

I use Cloudinary for my blog site (built with node js).
My problem is that when I upload an image from an iPhone, it rotates 90 degrees. I have already tried angle: "ignore" but this does not seem to work. I think it has to do with the exif information. How do I get rid of it or am I using the wrong cloudinary parameters?
(also does not work when I include a_ignore in the url)

Here is the upload code:

let result = await cloudinary.uploader.upload(req.file.path, {resource_type: type, angle:"ignore"});

SSMS sql server logs rotate date

we have a sql server which rotates it’s logs using a job.
But the rotation/creation date of the log is not shown (see screenshot). Any help would be great!
sql server log view

How to rotate model in character tool in Cryengine V?

I am trying to rotate a model using the character tool in Cryengine 5.6.2. I tried to post this question in the cryengine forums but community are dead and there is no help to understand how thys engime work and this is giving me hundreds of headaches. I used a third person character template as default and imported a model in it but I noticed that in the above section appears three icons that moves, rotates and transforms the model but when clicking on them nothing happens and model is not able to modify:

enter image description here

My main problem is that the character is imported using third person shooter template is backwards:

enter image description here

I am trying to find a way to rotate it, in the editor or in the C# code but I am still stuck. The main solution is to rotate it using blender but I am too lazy and this engime should strongly have a option to rotate this easily. How can I rotate it?

unit – How to rotate cubemap in shadergraph?

I know how to rotate the cube map with an inherited surface shader

Shader rotation matrix:

uniform float4x4 _Rotation;
          o.Emission = texCUBE (_Cube,  mul(_Rotation, float4(IN.worldRefl,0))).rgb;

RotateCubeMap:

using UnityEngine;

public class RotateCubeMap : MonoBehaviour
{
    public float speed = 20;
    private MeshRenderer _meshRenderer;

    private void Awake()
    {
        _meshRenderer = GetComponent();
    }

    public void Update()
    {
        var rot = Quaternion.Euler (0, Time.time*speed, 0); 
        var m = new Matrix4x4 ();
        m.SetTRS(Vector3.zero, rot,new Vector3(1,1,1) );
        _meshRenderer.material.SetMatrix ("_Rotation", m);
    }
}

I tried to recreate it by shadergraph

enter description of image here

but it didn't work!

enter description of image here

I need a result like this:

enter description of image here

unit – Rotate the rigid body with an angular momentum and a direction towards the target

I create a skier game in which the user can spin freely in the air depending on the input.

Roughly:

        Vector3 pitchTorque = input.pitch * pitchPower * transform.right;
         rb.AddTorque(pitchTorque, ForceMode.Acceleration);

        Vector3 yawTorque = input.yaw * airtimeRotationPower * transform.up;
        rb.AddTorque(yawTorque, ForceMode.Acceleration);

Now that the user is approaching the ground, the skier can be upside down or face sideways.

To make the landing smoother, I want the skier's rotation to automatically correct itself as it approaches the ground, so that the front or the back (which is closest – as a skier can land with the back as before) faces the direction of the current speed and the top, being the same as the normal ground. However, to get to this specific target rotation, I don't necessarily want the closest path, but the rotation path that has the current speed and direction of rotation in mind.

Here is what I have now:

// A value that ranges from 0-1 where 1 is very close to the ground and 0 is far.
float groundDistanceFactor = this.getGroundDistance();
// The current ground normal below the skier
Vector3 groundNormal = this.getGroundNormal();

Vector3 headingDirection = rb.velocity.normalized;
Vector3 forwardDirection = transform.forward;
headingDirection.y = 0;
forwardDirection.y = 0;
float forwardFactor = Vector3.Dot(forwardDirection, headingDirection);
float useForward = 1;
if (forwardFactor <= 0) {
    useForward = -1;
}

Vector3 target = rb.velocity * useFoward;
target = Vector3.ProjectOnPlane(target, groundNormal);
Quaternion targetRotation = Quaternion.LookRotation(target, groundNormal);

 transform.rotation = Quaternion.Slerp(
                    transform.rotation, targetRotation,
                    10f * groundDistanceFactor * Time.fixedDeltaTime);


It works a bit, but Quaternion.Slerp spins with the path closest to targetRotation, which is not what I want, because if the skier turns in one direction, it can cause the skier to suddenly rotate against the current angular impulse, which gives it an unnatural appearance.

I would like that if for example the skier turns anti-clockwise (on a given axis), he continues to turn in this direction until the targetRotation.

How can I achieve something like this?

unit – How to rotate an object at random speed with some delays?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Turn_Move : MonoBehaviour {
    public int TurnX;
    public int TurnY;
    public int TurnZ;

    public int MoveX;
    public int MoveY;
    public int MoveZ;

    public bool World;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        if (World == true) {
            transform.Rotate(TurnX * Time.deltaTime,TurnY * Time.deltaTime,TurnZ * Time.deltaTime, Space.World);
            transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.World);
        }else{
            transform.Rotate(TurnX * Time.deltaTime,Random.Range(3,300) * Time.deltaTime,TurnZ * Time.deltaTime, Space.Self);
            transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.Self);
        }
    }
}

This is the random part:

Random.Range(3,300)

but it changes the random numbers too quickly, the changes are almost invisible. I kind of want that if, for example, the next random remains for example 5 seconds at that speed number, go to the next random number and stay at that number again for 5 seconds and so on.

I tried this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Turn_Move : MonoBehaviour {
    public int TurnX;
    public int TurnY;
    public int TurnZ;

    public int MoveX;
    public int MoveY;
    public int MoveZ;

    public bool World;

    private bool IsGameRunning = false;

    // Use this for initialization
    void Start () 
    {
        IsGameRunning = true;
        StartCoroutine(SpeedWaitForSeconds());
    }

    // Update is called once per frame
    void Update () {

    }

    IEnumerator SpeedWaitForSeconds()
    {
        var delay = new WaitForSeconds(3);//define ONCE to avoid memory leak
        while (IsGameRunning)
        {
            if (World == true)
            {
                transform.Rotate(TurnX * Time.deltaTime, TurnY * Time.deltaTime, TurnZ * Time.deltaTime, Space.World);
                transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.World);
            }
            else
            {
                transform.Rotate(TurnX * Time.deltaTime, Random.Range(3, 300) * Time.deltaTime, TurnZ * Time.deltaTime, Space.Self);
                transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.Self);
            }

            yield return delay;//wait
        }
    }
}

but it just spins the object once every 3 seconds. and do not rotate it all the time with a gear change every 3 seconds.

but now it doesn't spin for 3 seconds, it spins every 3 seconds.

better describe what i want, it's like intervals. The object must rotate all the time without stopping like i Update but then every 3 seconds to change to a random speed.

for example, spinning at speed 5 …. after 3 seconds of spinning at speed 77 …. after 3 seconds of spinning at speed 199

rotation – Rotate the rigid body with a right click

using UnityEngine;
using System.Collections;

public class drag : MonoBehaviour
{

    public float catchingDistance = 3f;
    bool isDragging = false;
    GameObject draggingObject;
    // Use this for initialization
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            if (!isDragging)
            {
                draggingObject = GetObjectFromMouseRaycast();
                if (draggingObject)
                {
                    draggingObject.GetComponent().isKinematic = true;
                    isDragging = true;
                }
            }
            else if (draggingObject != null)
            {
                draggingObject.GetComponent().MovePosition(CalculateMouse3DVector());
                  

            }
        }
        else
        {
            if (draggingObject != null)
            {
                draggingObject.GetComponent().isKinematic = false;

            }
            isDragging = false;
        }
    }
    private GameObject GetObjectFromMouseRaycast()
    {
        GameObject gmObj = null;
        RaycastHit hitInfo = new RaycastHit();
        bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
        if ((hit) && (hitInfo.collider.CompareTag("Move")))
        {
            if (hitInfo.collider.gameObject.GetComponent() &&
                Vector3.Distance(hitInfo.collider.gameObject.transform.position,
                transform.position) <= catchingDistance)
            {
                gmObj = hitInfo.collider.gameObject;
            }
        }
        return gmObj;
    }
    private Vector3 CalculateMouse3DVector()
    {
        Vector3 v3 = Input.mousePosition;
        v3.z = catchingDistance;
        v3 = Camera.main.ScreenToWorldPoint(v3);
        //  Debug.Log(v3); //Current Position of mouse in world space
        return v3;
    }
    

}

javascript – Rotate the node code by pressing a button in html

Hello gentlemen, I am a beginner in Node and Javascript in general, I use express.js and I want that by pressing the button "SEND" it will execute a code (which is used to send an email) :

Print my HTML

The node code I want to execute when I press the button:

const nodemailer = require('nodemailer')

function emailSend() {
  let transporter = nodemailer.createTransport({
    host: "smtp.gmail.com",
    port: 465,
    secure: true,
    auth: {
      user: "meuemail.Kappa@gmail.com",
      pass: "senha321" //nao 'e meu email kkkkkk

    }
  })

  transporter.sendMail({
    from: "Herbert Richard ",
    to: "kappa.canal@gmail.com",
    subject: "Teste de envio de email",
    text: "Ola, sou hebert richard e estou testando o nodemailer"
  }).then(message => {
    console.log(message);
  }).catch(err => {
    console.log(err);
  })
}

My express:

const express = require('express')
const app = express()

app.get("https://pt.stackoverflow.com/", function(req, res){
    res.sendFile(__dirname + '/src/index.html')
})

app.get("/style.css", function(req,res){
    res.sendFile(__dirname + "/src/style.css")
})

app.get("/runeterra-logo.png", function(req, res){
    res.sendFile(__dirname + '/src/runeterra-logo.png')
})

app.get("/wallpaper.jpg", function(req, res){
    res.sendFile(__dirname + '/src/wallpaper.jpg')
})

var server = app.listen(3000);