Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jannich840 · Sep 18, 2011 at 06:56 PM · movementcharacterjumpforwardbackwards

Simple Character Movement

hi im new to this scipting part but i really need a simple script for my charater the only thing that he shall do is to walk forward and backward and jump and if you have a camera to that i could also use that ;) hope you guys will help

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Meltdown · Sep 18, 2011 at 06:58 PM

Nobody is going to write your scripts for you. You'll need to do your own research and ask specific questions on parts of your script you might be having problems with.

Take a look at the FPS tutorial and go through it from start to end and learn and understand how everything was done there, and then apply what you learnt to your project. It always helps to understand whats going on, you'll never learn if people just 'give' you scripts.

Good luck :p

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by CrowdedWorlds · Sep 19, 2011 at 12:09 AM

Unity ships with a basic set of controllers in it's 'Standard Assets' which you can import and get going with quite quickly. If you're like me, you might find it handy to reverse engineer these and gain a lot more from the experience than just plonking them in : )

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Clunk · Sep 19, 2011 at 04:04 AM

The best way is to use the First Person Controller asset built into Unity. But here is the SIMPLEST script option to at least teach you the minimal scripting part of it for now. I won't get advanced at all. Just attach this script to a box. Make that box a rigidbody. Attach the main camera to the box. Set the player_jump variable in the inspector. int means intriguer, which mean a number without a decimal(1, 2, 3, etc...) float means a number with a decimal (1.0, 2.000, 3.04848648, etc...) This script will make you walk forward / back, sideways with the horizontal and vertical axes (w,a,s,d), or arrow keys, and jump with the spacebar. Set gravity in edit / project settings / physics. when I do anything like (0,0,0), this is the axes (x,y,z). Whatever I put in these instances adds a value to those axes :) Like (0, player_jump, 0) in the script means 0 on x axis, player_jump value on y, and 0 on z.

var player_jump : int; var walk_speed : float;

function Update() { transform.Translate(Input.GetAxis("Horizontal") walk_speed, 0,
Input.GetAxis("Vertical")
walk_speed);

if(Input.GetKeyDown("space")) { rigidbody.AddForce (0, player_jump, 0); }

}

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Mixamo Character Movement 0 Answers

Why won't Character Controller Move Forward while in the Air? 2 Answers

3rd person controller, jump Error 1 Answer

movement doesnt stop when jump pad is tapped at the same time 0 Answers

Can't jump in C# 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges