unity5不能直接使用unity3d rigidbody2d改怎么解决

3615人阅读
Unity3D(1)
Unity 5在经过若干Beta、RC版迭代之后,千呼万唤始出来,对于需要从Unity 4.x切换到Unity 5的用户来说,一些已有的认识需要调整,这些内容包括但不限于:
1.&Moving static colliders does not cause performance penalty anymore. 在Unity 5之前,移动一个静态的collider会存在可观的性能损耗,但在Unity 5中,这个问题已经被解决。
2. In Unity5 we also cache the transform component on the c# side, so there should no longer be a performance reason to cache the transform component yourself. 在Unity 5之前,直接引用transform会有较大的性能开销,所以一般的做法是在组件的Start或Awake方法中缓存一下这个transform,现在Unity 5已经帮我们做了这个事情,所以程序员不需要再额外对transform进行缓存。
3.&Removed quick property accessors, like .rigidBody, .rigidbody2D, .camera, .light, .animation, .constantForce, .renderer, .audio, .networkView, .guiTexture, .collider, .collider2D, .particleSystem, .particleEmitter, .guiText, .hingeJoint for modularization.
Instead, use GetComponent to get references.由于Unity 5采用模块化思想对底层进行了重写,原来定义的一些便利属性访问器被取消。旧工程升级时可以参考&。
4. In Unity 5.0, we have a new AssetBundle build system which is much more easier to use than the old one. Unity 5引入了新的AssetBundle打包系统,相较于之前的版本,使用更方便,具体参见
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:138642次
积分:1421
积分:1421
排名:千里之外
原创:20篇
评论:89条
(1)(1)(2)(1)(1)(2)(1)(2)(1)(1)(1)(1)(2)(2)(2)(2)(1)
(window.slotbydup = window.slotbydup || []).push({
id: '4740881',
container: s,
size: '200,200',
display: 'inlay-fix'Version: 2017.2 ()
LanguageEnglish
Script language
Select your preferred scripting language. All code snippets will be displayed in this language.
UnityEngine
Inherits from:
Other Versions
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
Submission failed
For some reason your suggested change could not be submitted. Please &a&try again&/a& in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Your email
Suggestion*
Submit suggestion
Description
Control of an object's position through physics simulation.
Adding a Rigidbody component to an object will put its motion under the control of Unity's physics engine. Even without adding any code, a Rigidbody object will be pulled downward by gravity and will react to collisions with incoming objects if the right
component is also present.The Rigidbody also has a scripting API that lets you apply forces to the object and control it in a physically realistic way. For example, a car's behaviour can be specified in terms of the forces applied by the wheels. Given this information, the physics engine can handle most other aspects of the car's motion, so it will accelerate realistically and respond correctly to collisions.In a script, the
function is recommended as the place to apply forces and change Rigidbody settings (as opposed to , which is used for most other frame update tasks). The reason for this is that physics updates are carried out in measured time steps that don't coincide with the frame update. FixedUpdate is called immediately before each physics update and so any changes made there will be processed directly.A common problem when starting out with Rigidbodies is that the game physics appears to run in "slow motion". This is actually due to the scale used for your models. The default gravity settings assume that one world unit corresponds to one metre of distance. With non-physical games, it doesn't make much difference if your models are all 100 units long but when using physics, they will be treated as very large objects. If a large scale is used for objects that are supposed to be small, they will appear to fall very slowly - the physics engine thinks they are very large objects falling over very large distances. With this in mind, be sure to keep your objects more or less at their scale in real life (so a car should be about 4 units = 4 metres, for example).
Properties
The angular drag of the object.
The angular velocity vector of the rigidbody measured in radians per second.
The center of mass relative to the transform's origin.
The Rigidbody's collision detection mode.
Controls which degrees of freedom are allowed for the simulation of this Rigidbody.
Should collision detection be enabled? (By default always enabled).
The drag of the object.
Controls whether physics will change the rotation of the object.
The diagonal inertia tensor of mass relative to the center of mass.
The rotation of the inertia tensor.
Interpolation allows you to smooth out the effect of running physics at a fixed frame rate.
Controls whether physics affects the rigidbody.
The mass of the rigidbody.
The maximimum angular velocity of the rigidbody. (Default 7) range { 0, infinity }.
Maximum velocity of a rigidbody when moving out of penetrating state.
The position of the rigidbody.
The rotation of the rigidbody.
The mass-normalized energy threshold, below which objects start going to sleep.
The solverIterations determines how accurately Rigidbody joints and collision contacts are resolved. Overrides Physics.defaultSolverIterations. Must be positive.
The solverVelocityIterations affects how how accurately Rigidbody joints and collision contacts are resolved. Overrides Physics.defaultSolverVelocityIterations. Must be positive.
Controls whether gravity affects this rigidbody.
The velocity vector of the rigidbody.
The center of mass of the rigidbody in world space (Read Only).
Public Methods
Applies a force to a rigidbody that simulates explosion effects.
Adds a force to the Rigidbody.
Applies force at position. As a result this will apply a torque and force on the object.
Adds a force to the rigidbody relative to its coordinate system.
Adds a torque to the rigidbody relative to its coordinate system.
Adds a torque to the rigidbody.
The closest point to the bounding box of the attached colliders.
The velocity of the rigidbody at the point worldPoint in global space.
The velocity relative to the rigidbody at the point relativePoint.
Is the rigidbody sleeping?
Moves the rigidbody to position.
Rotates the rigidbody to rotation.
Reset the center of mass of the rigidbody.
Reset the inertia tensor value and rotation.
Sets the mass based on the attached colliders assuming a constant density.
Forces a rigidbody to sleep at least one frame.
Tests if a rigidbody would collide with anything, if it was moved through the scene.
Like Rigidbody.SweepTest, but returns all hits.
Forces a rigidbody to wake up.
OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
OnCollisionEnter is called when this collider/rigidbody has stopped touching another rigidbody/collider.
OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
Inherited Members
Properties
The game object this component is attached to. A component is always attached to a game object.
The tag of this game object.
The Transform attached to this GameObject.
Should the object be hidden, saved with the scene or modifiable by the user?
The name of the object.
Public Methods
Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
Is this game object tagged with tag ?
Returns the component of Type type if the game object has one attached, null if it doesn't.
Returns the component of Type type in the GameObject or any of its children using depth first search.
Returns the component of Type type in the GameObject or any of its parents.
Returns all components of Type type in the GameObject.
Returns all components of Type type in the GameObject or any of its children.
Returns all components of Type type in the GameObject or any of its parents.
Calls the method named methodName on every MonoBehaviour in this game object.
Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
Returns the instance id of the object.
Returns the name of the game object.
Static Methods
Removes a gameobject, component or asset.
Destroys the object obj immediately. You are strongly recommended to use Destroy instead.
Makes the object target not be destroyed automatically when loading a new scene.
Returns the first active loaded object of Type type.
Returns a list of all active loaded objects of Type type.
Clones the object original and returns the clone.
Does the object exist?
Compares if two objects refer to a different object.
Compares two object references to see if they refer to the same object.
Did you find this page useful? Please give it a rating:Unity物理引擎系统里两个常用组件- Rigidbody、Collider_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
Unity物理引擎系统里两个常用组件- Rigidbody、Collider
中国移动互联网行业领军品牌|
总评分0.0|
阅读已结束,下载文档到电脑
想免费下载更多文档?
定制HR最喜欢的简历
下载文档到电脑,方便使用
还剩5页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢UNity5怎么停用Rigidbody组件?【unity3d吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:77,217贴子:
UNity5怎么停用Rigidbody组件?收藏
我想先停用一下第一人称身上的Rigidbody组件,然后在需要的时候再打开。在网上找了一下说可以用GameObject.Find(&FPSController&).gameObject.GetComponent&Rigidbody&().enable关闭,但是报错说找不到穿上命令Assets/�ű�/TiZi.cs(29,21): error CS1061: Type `UnityEngine.Rigidbody' does not contain a definition for `enable' and no extension method `enable' of type `UnityEngine.Rigidbody' could be found (are you missing a using directive or an assembly reference?)
救助大神们帮助。。。
学特色小吃哪家好? 找苏味轩 包教包会 一费到底 学2送2 自己创业做老板!
我也不太懂啦但是disable才是关闭的意思,enable是开启的意思。
自己顶一个
我知道了。enabled,你少写个d正确的写法GetComponent&Rigidbody&().enabled =
看看官方手册,没有这个属性吧??file:///C:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/html/en/ScriptReference/Rigidbody.htmlrigidbody自身没有,继承于父类component也没有,你这个应该属于编译错误吧
如果你要停用 直接 destory (刚体组件可以直接销毁的)
如果是为了关闭重力,可以使用GetComponent&Rigidbody& ().useGravity =
登录百度帐号推荐应用

我要回帖

更多关于 unity3drigidbody 的文章

 

随机推荐