


I'm using domain repetition to get an infinite amount of cones, and so domainOrigin is the center of the current domain, then I shift the p (which is the sampled point) into the new domain, and I get the z and x rotations and create the rotation matrix from that, then multiply the sample point by the matrix, which will rotate p. Return max(dot(angle.xy, float2(q, p.y)), -height - p.y) My guess is that I need to get the angle between the x and y coordinate of the current cone to get the z rotation, and get the angle between z and y coordinates for the x rotation, here is my code : public float Distance(float3 p)įloat3 domainOrigin = round(p / domainRep) * domainRep įloat zrot = dot(domainOrigin.x, domainOrigin.y) įloat xrot = dot(domainOrigin.z, domainOrigin.y) įloat3x3 mat = inverse(mul(rotateX(zrot), rotateZ(xrot))) Also, I don't know what order of rotation I would want or need for the Euler angles, but I believe that would be fairly easy to modify later.I'm trying to rotate a lot of cone SDFs but I can't get the correct angle, the correct angle is supposed to be the one that will all the tip of the cones point to the world center. Given that the vectors themselves are reliable, I see no reason why it would not be possible to work out reliable Euler angles from them. I realise this is a bit complicated, but that's why I ask here: I lack the knowledge and experience to work out this problem myself. I need to calculate reliable 3D Euler angles (as in, ones that don't flip from + to - "randomly") from Forward, Up and Right vectors. I can easily extract Euler angles from the Quaternions, but they are unreliable and cause the ragdoll to spaz out severely.

The AddTorque function effectively works in Euler angles, which means I can't use the Quaternions. I can work fully in Quaternions right up to the point where I need to apply the torque to the rigidbodies. I'm trying to play an animation on a humanoid bone structure and, using torque (rotational force), push the physics ragdoll into approximately the same pose as the bone structure. Unity uses a left-handed coordinate system.I'm NOT trying to get anyone to write the code for me! I'm only asking for the answer in code or pseudo-code because I never learned to read normal maths squiggles I'm a programmer, not a mathematician.A C++ style answer would be easiest for me to understand, but I can work out pretty much any kind of code.This is ensured by the following code: lat Math.max(-85, Math.min(85, lat)) lat Math.max (-85, Math. This is to make sure that the user can’t look too far up or down and flip the camera in a strange way. I don't understand maths very well at all unless it's written in code (or pseudo-code), so this would be most beneficial to me. Before moving forward, it is ensured that the lat variable is between -85 and 85 degrees.I can't simply record my own Euler angles, modify them and apply the rotation through a new Quaternion because the object is controlled by physics. They extracted a variety of features from the acceleration vector magnitude and used these as input for a Hidden Markov Model (HMM) to classify sleep versus wakefulness, as well as to discriminate.

