Title: How to add force above com in unity3d?
Tags: c#;unity3d
Question: using UnityEngine;
public class Movement : MonoBehaviour
public Rigidbody rb;
public float f = 100;
public float b = -100;
public float l = -100;
public float r = 100;
public float u = 10;
public bool onGround = true;
// Start is called before the first frame update
void Start()
// Update is called once per frame
void Update()
if (onGround)
{
if (Input.GetKeyDown(&quot;space&quot;))
{
rb.AddForce(0, u, 0, ForceMode.VelocityChange);
onGround = false;
}
}
if (Input.GetKey(&quot;w&quot;))
{
rb.AddForce(0, 0, f);
}
if (Input.GetKey(&quot;a&quot;))
{
rb.AddForce(l, 0, 0);
}
if (Input.GetKey(&quot;d&quot;))
{
rb.AddForce(r, 0, 0);
}
if (Input.GetKey(&quot;s&quot;))
{
rb.AddForce(0, 0, b);
}
if(onGround == false)
{
rb.AddForce(Physics.gravity * rb.mass);
}
private void OnCollisionEnter(Collision collision)
if(collision.collider.tag == &quot;Ground&quot;)
{
onGround = true;
}
This is my code. Since I wanted my cube to topple while moving, I would like to add forces above center of mass with a slight delay. According to how I visualize, this will make the cube topple.
How could I do this, Is this a good way of doing this or there is another way to topple my cube? Thanks.

Here is the accepted answer: you can do it in unity directly by adding physical material to the cube in it's (Box Collider) and changing the values, but if you want to do it from code you have to mention it first and then edit its values
like this:
using UnityEngine;
public class TestPlayerMovement : MonoBehaviour {
public BoxCollider BX;
// and then drag it from unity
void FixedUpdate () {
//it's better to use FixedUpdate bec it's movement
//examples
BX.material.bounciness = 0;
BX.material.dynamicFriction = 0;
BX.material.staticFriction = 0;
print (BX.material.staticFriction);
print (BX.material.bounciness);
print (BX.material.dynamicFriction);
Comment for this answer: I didn't understand how we can use Box collider to add delay or how to change position of force acting?
Comment for this answer: Thank's a lot for the help!
Comment for this answer: in box collider, there's a thing called material that's responsible for friction and bounciness, so if  you increased your friction with the floor will make  the cube topple and also notice that it's a cube it's not that easy to make it topple on its own try to use a capsule for example


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:10/15/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><unity3d>', 'Title': 'How to add force above com in unity3d?', 'ViewCount': 52, 'id': 64366166, 'user_AboutMe': '<p>Because I am batman</p>\n', 'user_AccountId': 19663941.0, 'user_DisplayName': 'RyugaGod', 'user_Reputation': 113.0, 'user_Views': 2.0, 'user_id': 14453836.0}}