Acceleration physically with Rotation

Hi,

Im pretty new so its probably easy for you guys to answer.

I used a Sphere as an PlayerObject and set a key to rotate the Sphere. The Goal i was aiming was that the Sphere physically starts moving caused by its gravitiy and collision.

Well its just rotating on the original position, at least under my command, but its not moving.

Is it actually possible or am i just thinking to realistic for unity ?
Thanks for your Help guys !

Yep, that’s possible. I’d have thought it would work out of the box for both 2d and 3d, but if it doesn’t,

  1. make sure that your ball and the ground have colliders.
  2. make sure you’re using a Rigidbody for the ball, and the Rigidbody’s torque for rotation.
  3. Increase the friction of the ball’s physics material.

in that order.

To start, modifying rotation using Transform.rotation will not apply any changes recognizable by physics, so using Rigidbody.AddTorque() is the way to go in this scenario.

This example will be based on two-axis input as a point of reference, but can easily be adjusted to suit your specific needs:

private Vector2 playerInput;
private Rigidbody rb;
public float torque = 5.0f; // 5 revolutions-per-second per-second acceleration example

void Start()
{
	rb = GetComponent<Rigidbody>();
	rb.maxAngularVelocity = 500f; // Let's go higher than the default 7
}

void Update()
{
	playerInput = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
}

void FixedUpdate()
{
	Vector3 appliedTorque = new Vector3(playerInput.y, 0f, playerInput.x) * torque;
	rb.AddTorque(appliedTorque, ForceMode.Acceleration); // This ForceMode ignores mass, as/if desired
}

Oh Yeah,

thank you so much. After I added the torque it still didnt work. Seems like it was all about the physics material which i didnt create yet - well i even didnt know it exists. Thanks FlaSh-G \m/

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Torque : MonoBehaviour
{

    public float torque;
    public Rigidbody rb;

    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();    
    }

    // Update is called once per frame
    void Update()
    {
        float turn = Input.GetAxis("Horizontal");
        rb.AddTorque(transform.forward * torque * turn);
    }
}