Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by thomz12 · Jul 24, 2013 at 07:54 PM · rigidbodyslowfast

all Rigid body's slow down and speed up

hey!

I have a problem with my game: All rigid body's slow down and speed up when I play the game. Sometimes it's like nothing ever happened, and sometimes all the rigid body's react slow!

Comment
Add comment · Show 5
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 roojerry · Jul 24, 2013 at 08:06 PM 0
Share

are you adding force or moving your rigidbodies within FixedUpdate?

avatar image thomz12 · Jul 24, 2013 at 08:09 PM 0
Share

Yes I'm adding force within FixedUpdate

avatar image Benproductions1 · Jul 24, 2013 at 11:13 PM 0
Share

Can you post your script? Is it posible something else is doing something to the rigidbodys?

avatar image ikelaiah · Jul 24, 2013 at 11:17 PM 0
Share

What are you making? Could you post a screenshot?

avatar image thomz12 · Jul 25, 2013 at 06:19 AM 0
Share

I only use a script for moving the player, wich is just simple adding force on the z-axis and limiting the force of the player.

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by clunk47 · Jul 25, 2013 at 06:28 AM

You could either do some homework on rigidbody characters, or just use a CharacterController. Unity installer has an asset pack you can import, makes things easy, unless you're wanting to do something different because you want to learn. If that's the case, here's something to get you started. This exmaple is written in C-Sharp.

 //RigidbodyCharacterController.cs
 
 
 using UnityEngine;
 using System.Collections;
  
 public class RigidbodyCharacterController: MonoBehaviour {
  
         public int turnSpeed;
         public int moveSpeed;
         public int jumpForce;
        
         bool onGround;
        
         // Use this for initialization
         void Start () {
        
         }
        
         // Update is called once per frame
         void FixedUpdate () {
        
                 float h = Input.GetAxis("Horizontal");
                 float v = Input.GetAxis("Vertical");
                
                 transform.Rotate( 0, h * turnSpeed * Time.deltaTime, 0 );
                 Vector3 moveAmount = transform.forward * v * moveSpeed;
                 rigidbody.MovePosition( transform.position + moveAmount * Time.deltaTime );
                 rigidbody.velocity = moveAmount + Vector3.Scale(rigidbody.velocity, new Vector3(0,1,0));       
                
                 if (onGround && Input.GetKey(KeyCode.Space))
                 {
                         rigidbody.AddForce( transform.up * jumpForce, ForceMode.Impulse );     
                         onGround = false;
                 }
         }
        
         void OnCollisionEnter() {
        
                 onGround = true;
                
         }
        
 }
Comment
Add comment · Show 4 · 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 thomz12 · Jul 25, 2013 at 07:20 AM 1
Share

Thanks! I didn't use the character controller because I wanted to create it myself. I enjoy making that a lot more! thanks for you answer! It solved the problem! Thanks!

avatar image clunk47 · Jul 25, 2013 at 07:21 AM 2
Share

You're very welcome. Glad to see someone wanting to learn rather than just using built in controllers or just demanding that people write them scripts lol. $$anonymous$$ade my day a bit better. Have a good one dude!

avatar image thomz12 · Jul 25, 2013 at 07:26 AM 1
Share

Yea, I don't like taking other people's scripts. ins$$anonymous$$d I take pieces of it and trying to understand it and modify it. That's a lot more fun and you learn very good by doing that!

avatar image clunk47 · Jul 25, 2013 at 07:29 AM 1
Share

Gets easier and easier brotha. Have a good night man, I'm outski.

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

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Apply force then slowly back off 4 Answers

My objects are falling to slowly when a rigidbody is attached, cab you help? 9 Answers

Low framerate on physics initialization. 0 Answers

Fast moving object not detect collision 3 Answers

slow addforce 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