Unity3d Role Code Control issues

Source: Internet
Author: User

2015/07/06////////

by xbw//////////////

Environmental unity4.6.1//

Share some Unity character control code;;

Using unityengine;using System.collections;public class playcontrol:monobehaviour{public   float Movespeed =10f;< C1/>void Update () {    if (Input.getkey (keycode.uparrow))             transform. Translate (Vector3.forward * movespeed*time.deltatime);           if (Input.getkey (keycode.downarrow))           transform. Translate (Vector3.back * movespeed * time.deltatime);        if (Input.getkey (keycode.leftarrow))           transform. Translate (Vector3.left * movespeed * time.deltatime);        if (Input.getkey (keycode.rightarrow))          transform. Translate (vector3.right * movespeed * time.deltatime);   if (Input.getkey (keycode.space))       transform. Translate (vector3.up * movespeed * time.deltatime);    }}

This is the CSharp direction key plus the space jump control character code;;;

Test object is a cube, no collision is OK, add a collision, the physical effects of the cube direction is broken,

Can't control the object very well, it's a problem, and it's going to be solved later,

Add Unity code Smoothfollow.js to the main camera, you can see good game effect,

As for how to add, see my other articles, the realization of the scene cycle of the article ....

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Unity3d Role Code Control issues

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.