It’s funny, since before Unity existed everyone know Lerp and Slerp can go past either end. But I think going 110% of the way from A to B confused game designers, so they liked the normal version being clamped.

Price Point $$ $ - Cheap Eats (Under $10) $$ - Moderate ($11-$25) $$$ - Expensive ($25-$50) $$$$ - Very Pricey (Over $50)

The food here is absolutely delicious, with generous portions and flavors that hit the spot. The delivery was prompt, and every dish we tried, from th... see review

There might be faster ways to do it taking advantage of the fact that you know A-C and B-C have equal magnitude, but I couldn’t list them off-hand. Unless you are doing this calculation thousands of times per frame, you probably won’t notice any efficiency difference.

I don’t believe newlife is talking about normalizing the vectors, but about normalizing the weights used for interpolation.

Image

In order to use Vector3.Slerp, I have to normalize the weights (a and b) cause T is [0,1]. Im sorry for the silly question, but how to do this? I cant find a solution…

I need this to find the correct contact points for a rgidbody wheel Im using for my vehicle simulation. So the circle in actually is a 3D cylinder, so when there are two different contact area, and I should make the centroid of the first set of contact points, then the centroid of the second area and the a circular interpolation between the two centroids. Right now Im making a centroid of ALL the contact points (so actually a linear interpolation between all the points), now Im trying to convert the result to a circular interpolation. The easiest way to solve this would be to calculate two different centroid for the two different set of contact points, but in Unity is not easy to manage separately these two sets.

Mostly correct. They are interpreted as positions in the local space of the circle. Both the local direction and length of the vectors are interpolated, so the final output is a local space position, not a direction. In this case, you need to convert the inputs to local space before the slerp, and the output to world space after the slerp. I’ll explain below.

Port Tavern menu

Oh I see… if the weights are giving a value outside of 0 to 1, I don’t think Slerp is the right option. Slerp will only give a position on the circle between the 2 input positions

Port city tavern

Unlike Unity Answers, forum threads are expected to wander. Some people wanted to talk about weighted averages and outside-bounds lerps, which is fine. Of course, it’s also fine for you to try to get people to come back to your problem. To me, it sounds like settling on a solution too quickly. I often want to make something “go in the correct direction”, quickly pick math, solve it, and when it gives odd results, realize “the correct direction” wasn’t what I assumed it was.

Thank you for the replies. In order to use Vector3.Slerp, I have to normalize the weights (a and b) cause T is [0,1]. Im sorry for the silly question, but how to do this? I cant find a solution…

Ok so it seems that I found a decent solution. Basically Im calculating the Sin / Cos of the angle between the first normal and the interpolated normal and Im adding this value to the interpolated point (centroid), in the direction of the interpolated normal.

Finally, you can convert your new position on the circle to world space by adding the center position of the circle to the local position of the new point.

It’s funny, since before Unity existed everyone know Lerp and Slerp can go past either end. But I think going 110% of the way from A to B confused game designers, so they liked the normal version being clamped.

This pub offers delicious food and friendly service, making it a great spot to enjoy a meal. The atmosphere is laid-back and welcoming, perfect for a ... see review

First, try refreshing the page and clicking Current Location again. Make sure you click Allow or Grant Permissions if your browser asks for your location.

The grogNewburyport

Maybe it would be a better idea to convert those vectors to angles, multiply the angles by their weights, combine them, then convert the output angle back to a vector.

Oh I see… if the weights are giving a value outside of 0 to 1, I don’t think Slerp is the right option. Slerp will only give a position on the circle between the 2 input positions.

NewburyportRestaurants

where a and b are the weights. I would like to make a circular interpolation, that is M should always be a point of that circumference. Which is the fastest way to do this?

The two points A and B do not, by themselves, uniquely define a circle. (There are infinite possible circles that intersect both points.) So in the general case, you need enough extra information to determine which circle you want to interpolate along.

But calculating centroids is easy (it’s just the average of all the points in the set), so if you want to interpolate between the centroids of two collections, that sounds straightforward.

The interpolated normal is represented by dotted yellow lines (interpolated between the two normals in A and in B), the centroid is represented by the points a1, a2, a3 (interpolated between the two points A and B). contatcs[0].normal is the normal of the first contact point (in this case A). Let me know what you think about this solution.

Italian restaurantNewburyport

May I ask what is it that you want to use this for? is it like to chop a part of the circle, make an object go throw it’s curve when it collides, or what? I think knowing more about the context may help understand what are the limitations and challenges.

A “weighted average” will give a value in the allowed range, you just need to convert it. As I said above, weights A and B give you a value T = B / (B+A), which will always be in the range [0, 1] provided that A and B are nonnegative.

This brewery is awesome for dog lovers like me - they're super welcoming to our furry friends! The staff here is really friendly and accommodating, ma... see review

Pretty sure for Vector3.Slerp(A,B,T), A and B are interpreted as directions from the center of the circle, not world positions. Return value should too be a direction relative from the center as well.

Like if you say “I want a mixture of these two things, where the first one is given twice as much weight as the second” then you have interpolation weights of 2 and 1 respectively.

My family has been regulars here for years, drawn to the rich history and comforting flavors of this local Italian eatery in Lynn. The classic dishes ... see review

Image

The pizzas are great and they make an amazing roast beef sandwich, but sometimes the quality of the beef can be inconsistent. The people here are so f... see review

One possible way to do that is to provide the center of the circle; call it C. Then I believe C + Slerp(A-C, B-C) should give you the answer you want. (Notice that if C is the origin, this is the same as just Slerp(A, B).)

There might be faster ways to do it taking advantage of the fact that you know A-C and B-C have equal magnitude, but I couldn’t list them off-hand. Unless you are doing this calculation thousands of times per frame, you probably won’t notice any efficiency difference.

But calculating centroids is easy (it’s just the average of all the points in the set), so if you want to interpolate between the centroids of two collections, that sounds straightforward.

You can normalize a vector by just accessing it’s “.normalized” value. You can also get a normalized vector by dividing the vector by it’s length (which you know, since it’s the circle radius). However, I don’t think you’re heading in the right direction with that train of thought.

You can normalize a vector by just accessing it’s “.normalized” value. You can also get a normalized vector by dividing the vector by it’s length (which you know, since it’s the circle radius). However, I don’t think you’re heading in the right direction with that train of thought.

Pretty sure for Vector3.Slerp(A,B,T), A and B are interpreted as directions from the center of the circle, not world positions. Return value should too be a direction relative from the center as well.

Port TavernNewburyportmenu

As you can see, there are two set of contact points managed via onCollisionStay. Im using a custom contact point manager in order to have more control on these points (taken from https://discussions.unity.com/t/541083/5 ) modified in order to make the centroid of all contact points. Its working, but as for the question of this thread, its basically a linear interpolation of ALL the contact points, while I would like to obtain a circular interpolation between the two centroids.

I don’t believe I made any assumptions regarding the number of dimensions in my solution. I’m not sure what you mean by “contact points”.

I don’t believe I made any assumptions regarding the number of dimensions in my solution. I’m not sure what you mean by “contact points”.

Newburyportpubs

Irish pub newburyportreviews

Slerp isn’t suitable for world-space positions, you’ll want to move the positions into the local space of your circle by subtracting the position of the center of the circle from them.

One possible way to do that is to provide the center of the circle; call it C. Then I believe should give you the answer you want. (Notice that if C is the origin, this is the same as just Slerp(A, B).)

Unfortunately, this is not enough cause my case in actually 3D, not 2D. So i have several contact points instead of one single point A and several contact points instead of one single point B. Ideally, I should have to make the centroid of the points in A, then the centroid of the points in B and finally the circular interpolation between the two centroid. Unfortunately, this is not straightforward cause its not easy / possible to manage two sets of contact points in a 3D collision in Unity. Anyway, I have to investigate better, cause all points in A and B shares the same normal.

I don’t believe newlife is talking about normalizing the vectors, but about normalizing the weights used for interpolation.

Oh I see… if the weights are giving a value outside of 0 to 1, I don’t think Slerp is the right option. Slerp will only give a position on the circle between the 2 input positions.

Hello, i have two points A and B that stay on a known circumference (I know its radius). Now Im making a linear weighted interpolation in this way:

The two points A and B do not, by themselves, uniquely define a circle. (There are infinite possible circles that intersect both points.) So in the general case, you need enough extra information to determine which circle you want to interpolate along.