Hot answers tagged

2

I hadn't actually aligned in CatmullRom, it was one of my other tests. It got lost in all the messy code. The problem was solved by aligning the start and end points of the spline input. (params: pre, start, end, post) The issue could also be solved by using circular blending, which I hadn't know, but it works as well. This video demonstrates my problem and ...


1

When you hold the mouse button down, begin tracking the location of the mouse. Every frame, compare the current location with the location on the previous frame. If the vector from previous to current is large enough, orient the car in the direction of the vector. When you release the mouse button, stop: tracking, comparing and rotating. EDIT private ...


1

This is my solution, Google Earth like control with smooth animation (or not), when zoomed in it is user friendly and slows panning down. The only thing I am not satisfied about is the quaternion slerp, at these defaults there won't be any sudden jumps but I would have loved to understand how to sub-interpolate quaternions so it works even when rotating ...


1

I was tempted to vote to close this as primarily opinion-based, but we may be able to provide an evidence-based argument here. I'd recommend that your method rotate counter-clockwise for positive angles, for the sake of interoperability, and mathematical convention: Interoperability As you've pointed out, Unity's API already picks a side by using left-...


1

The two options are: 1.) NPCs run away from the player. With this one you just need to take the vector going from the player to the NPC, normalize it and set the NPCs velocity to this vector 2.) NPCs run perpendicular to the player's direction. To achieve this, you need to take the direction of the player and rotate it 90 degrees. Since there are two ...


1

Taking these two constraints: "position C gameObject such that it forms a right angled triangle with A and B" "I want the C to be along the local red axis of A" We can solve this relatively easily using A's transformation: // Transform point B into A's local space. Vector3 bInAsSpace = a.transform.InverseTransformPoint(b.transform.position); // Find a ...


Only top voted, non community-wiki answers of a minimum length are eligible