Home>
I'm playing with unity, but when I want to accelerate, there is no speed limit, so it gets really fast. When I reach a certain speed, I wonder if I can continue to run at that speed.
I will fly at a tremendous speed
Corresponding source codeWritten in Microsoft visual studio in C #
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyObject: MonoBehaviour
{
void FixedUpdate ()
{
Rigidbody rb = this.GetComponent
Vector3 force = new Vector3 (10f, 0.0f, 0.0f);// Set the force
rb.AddForce (force, ForceMode.Force);// Apply force
}
}
I wrote public float Speed = 200 ;, maybe this is the cause
Supplementary information (FW/tool version, etc.)unity 2018 4,12f1 personal.
-
Answer # 1
Related articles
- c # - [unity] i want to stop the script without using getcomopnent () enabled = false;
- c # - unity i want to access script variables attached to other objects
- c # - [unity] i want to start the variables of the script of multiple generated objects individually
- c # - code error of script implemented by unity cannot be resolved
- c # - slider ui is not generated from script in unity
- c # - i can't attach a script in unity (beginner)
- c # - i want to create a list of toggle in a unity script
- c # - i want to run unity: transformtranslate using rigidbody
- c # - [unity] when i try to refer to another script with getcomponent, an error occurs
- c # - if you want to extend the script of unity asset store
- c # - [unity] how to make a script that executes processing after a certain period of time
- c # - i want to call a method of another script in unity, but it doesn't work
- i want to use addforce to move forward when i press the q key in a c # script
- c # - play sound effects using unity is trigger
- unity sqlite cannot add data using unitykit
- c # - i want to specify a different url from the script side for the video player component of unity
- unity - i want to narrow my horizons using postprocess
- c # - i want to make a server-side gui application using websocket-sharp
- i want to change the value dynamically from a script with unity's post processing stack v2!
Related questions
- c # - player production in unity (shooting game)
- c # - please tell me how to use the additional components of unity's volunteer production
- c # - conversion from enum type to enum type
- c # - missingreferenceexception occurs even though there is a reference
- c # - i want to update the value
- c # - i want the camera to follow the player character in a tps game, but if i make multiple players in multiplayer, the camera
- c # - [unity] even though "has exit time" of animator is specified, it will transition to another state earlier than t
- c # - == becomes false even though the strings are equal
- c # - how to use start () in unity
- c # - in a script? error cs1056: unexpected character'?' is displayed even though there is no
After adding this as a variable
Try embedding this in your Fixed Update
I get the speed with rigidbody.velocity.magnitude so that it doesn't get any faster when it reaches the speed specified by LimitSpeed.
If this doesn't happen, it's in new Vector 3/ 1.1fIt may be better to adjust by increasing the number in the part of