When i grab a item in this case a ball, i try to rotate it using mouse scroll wheel, but its rotate in the x rotate position, How i can change it and rotate the ball where the player are looking.? using Raycast
pd: i am beginner :(.
To rotate an object, you need to know the axis of rotation.
If you want it to rotate around a ray coming from the player, you need this:
Vector3 axis = object.transform.position - player.transform.position;
If you want it to rotate perpendicularly to that ray, you probably want this
Vector3 axis = Quaternion.Euleur(0, 90, 0) * (object.transform.position - player.transform.position);
Once you have your axis, you need an angle, you probably want something like:
float angle = rotationSpeed * Time.deltaTime * Input.mouseScrollData;
Now, just apply that rotation:
object.transform.Rotate(axis, angle, Space.World);