say i have a Point at 0,0,0, it has a x, y, z radius which make a capsule, i have a object above it who’s distance to the point is it’s y radius, and i have a Vector2 angle (the z axis is useless for rotating around it)
say for example the angle was 90, 0. the object should be to the left of the point with the distance being the x radius,or if the angle was 0, 90 the object should be infront of the point with the distance being the z radius
how would i implement this? sorry for my drawing skills
From what I understand, it’s not a capsule but an ellipsoid.
You can work in the spherical coordinate system, see the formula in the wikipedia page. θ and φ are your x and y angle, r is your z but a constant in your case a, b, and c are defined by your vertical and horizontal radius (I assume horizontal radius is used twice).
The Unity Capsule primitive (both the CapsuleCollider and the Mesh) is definitely a cylinder connecting two hemispheres.
Those are not the same shapes.
As for OP’s question, the concept of rotating anything on any surface is to first find the normal at the point you are standing on.
Raycasts can give you normals, given back in the RaycastHit object when you hit the object.
This normal vector would be used to produce a rotation using one of the axis-relevant factory helpers in the Quaternion class, or perhaps just good old Transform.LookAt() with the second argument.
For a sphere, the haversine formulas might be what you need (Haversine formula - Wikipedia), for an ellipsoid (=earth) it is regrettably significantly more complicated (Vincenty's formulae - Wikipedia). Not quite sure if this is what you need; here an implementation to get from a given start Latitude+Longitude to an end Lat+Lon on an elipsoid, using heading angle + distance.