Unity 3d implements just physical strength

Source: Internet
Author: User

1. Select the object that has the rigid body added, and then add the constant force assembly.

This component can add a constant force or torque force to a rigid body, often used in a single-shot rigid body, such as a simulated rocket launch. The initial speed of this object is not very large, but with the passage of time, the acceleration will be more and more large.

Force: Add forces directly.

Relative force: Add relative forces.

Torque: Add torque force.

Relative Torque: Add relative torque force.

2. Sketch out the use of gravity option for the rigid body, then set the y-axis force to 0.5, when the game is running, the object will still fall.

We can use code to add force to a rigid body.

void Fixedupdate () {if (Input.getmousebuttondown (0)) {rigidbody. Addforce (0,10,0);}}

Add the script to the object. And then run

When clicked, you will see the rigid body rise slowly.

Unity 3d implements just physical strength

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.