包含9節(jié)視頻教程
這是臨摹的終極表現(xiàn)!在臨摹領(lǐng)域達(dá)到真實(shí)照片的級(jí)別,讓你的繪畫讓別人驚呼吧!這不是照片,真的是繪畫出來(lái)的。我們一起來(lái)學(xué)習(xí)吧!
|
The Mesh Collider takes a Mesh Asset and builds its Collider based on that mesh. It is far more accurate for collision detection than using primitives for complicated meshes. Mesh Colliders that are marked as Convex can collide with other Mesh Colliders. 網(wǎng)格碰撞器利用一個(gè)網(wǎng)格資源并在其上構(gòu)建碰撞器。對(duì)于復(fù)雜網(wǎng)狀模型上的碰撞檢測(cè),它要比應(yīng)用原型碰撞器精確的多。標(biāo)記為凸起的(Convex )的網(wǎng)格碰撞器才能夠和其他網(wǎng)格碰撞器發(fā)生碰撞。
Properties 屬性
Details 細(xì)節(jié)The Mesh Collider builds its collision representation from the Mesh attached to the GameObject, and reads the properties of the attached Transform to set its position and scale correctly. 網(wǎng)格碰撞器通過(guò)附加在游戲?qū)ο笊系木W(wǎng)格構(gòu)建碰撞效果,并嚴(yán)格按照所附加對(duì)象的Transform屬性來(lái)設(shè)定其位置和大小比例。 Collision meshes use backface culling. If an object collides with a mesh that will be backface culled graphically it will also not collide with it physically. 碰撞網(wǎng)格使用背面剔除(或譯背面揀選,指正面多邊形擋住了在它后面的背面多邊形,Direct3D將通過(guò)揀選(即刪除多余的處理過(guò)程)背面多邊形來(lái)提高效率的過(guò)程。)如果一個(gè)對(duì)象和被背面剔除的網(wǎng)格碰撞,那也不會(huì)在物理上碰撞。 There are some limitations when using the Mesh Collider. Usually, two Mesh Colliders cannot collide with each other. All Mesh Colliders can collide with any primitive Collider. If your mesh is marked as Convex, then it can collide with other Mesh Colliders. 使用網(wǎng)格碰撞器有一些限制條件。通常,兩個(gè)網(wǎng)格碰撞器之間不會(huì)發(fā)生碰撞。所有的網(wǎng)格碰撞器可以和任何原型碰撞器碰撞。如果網(wǎng)格標(biāo)記為凸起的(Convex),那么就可以和其他網(wǎng)格碰撞器碰撞。 Colliders work with Rigidbodies to bring physics in Unity to life. Whereas Rigidbodies allow objects to be controlled by physics, Colliders allow objects to collide with each other. Colliders must be added to objects independently of Rigidbodies. A Collider does not necessarily need a Rigidbody attached, but a Rigidbody must be attached in order for the object to move as a result of collisions. 碰撞器作用于剛體使Unity中的物理作用生效。因?yàn)閯傮w允許對(duì)象被物理系統(tǒng)控制。碰撞器使對(duì)象之間產(chǎn)生碰撞作用。碰撞器必須獨(dú)立于剛體加在對(duì)象上。碰撞器并不一定需要附加剛體,但是要使移動(dòng)物體具有碰撞效果必須附加剛體。 When a collision between two Colliders occurs and if at least one of them has a Rigidbody attached, three collision messages are sent out to the objects attached to them. These events can be handled in scripting, and allow you to create unique behaviors with or without making use of the built-in NVIDIA PhysX engine. 當(dāng)兩個(gè)碰撞器間產(chǎn)生碰撞并且其中至少一個(gè)附加了剛體時(shí),三個(gè)碰撞信息會(huì)發(fā)送給附加他們的對(duì)象,這些事件可以被腳本處理,而且允許用戶可以選擇自己寫腳本或使用內(nèi)置的NVIDIA PhysX引擎創(chuàng)建唯一的行為。 TriggersAn alternative way of using Colliders is to mark them as a Trigger, just check the IsTrigger property checkbox in the Inspector. Triggers are effectively ignored by the physics engine, and have a unique set of three trigger messages that are sent out when a collision with a Trigger occurs. Triggers are useful for triggering other events in your game, like cutscenes, automatic door opening, displaying tutorial messages, etc. Use your imagination! 一個(gè)可供選擇的碰撞器使用方法是標(biāo)記他們?yōu)橛|發(fā)器,僅需要選中檢視面板中的IsTrigger屬性選擇框。觸發(fā)器不受物理引擎控制,當(dāng)和一個(gè)觸發(fā)器發(fā)生碰撞時(shí)會(huì)發(fā)出三個(gè)獨(dú)特的觸發(fā)信息。觸發(fā)器用于觸發(fā)你游戲中的其他事件,比如過(guò)場(chǎng)動(dòng)畫、自動(dòng)門開啟、顯示教程信息等等,發(fā)揮你的想象力吧! Be aware that in order for two Triggers to send out trigger events when they collide, one of them must include a Rigidbody as well. For a Trigger to collide with a normal Collider, one of them must have a Rigidbody attached. For a detailed chart of different types of collisions, see the collision action matrix in the Advanced section below. 當(dāng)然也應(yīng)該意識(shí)到為了使兩個(gè)觸發(fā)器碰撞時(shí)發(fā)出碰撞事件,其中一個(gè)必須包含剛體。一個(gè)觸發(fā)器和一個(gè)普通碰撞器碰撞,其中之一必須附加剛體。想了解不同類型碰撞的詳細(xì)情況,可以參考下邊進(jìn)階部分中的碰撞行為矩陣。 Friction and bouncyness 摩擦力和彈力Friction, bouncyness and softness are defined in the Physic Material. The Standard Assets contain the most common physics materials. To use one of them click on the Physic Material drop-down and select one, eg. Ice. You can also create your own physics materials and tweak all friction values. 摩擦力、彈力和柔軟度由物理材質(zhì)中定義。標(biāo)準(zhǔn)資源( Standard Assets)中包含了大部分常見(jiàn)的物理材質(zhì)。要使用只需點(diǎn)擊物理材質(zhì)上的下拉箭頭然后選中一個(gè),比如冰。你也可以創(chuàng)建你自己的物理材質(zhì)并調(diào)整摩擦力的大小。 Hints 提示
Advanced 進(jìn)階Collider combinations 碰撞器組合There are numerous different combinations of collisions that can happen in Unity. Each game is unique, and different combinations may work better for different types of games. If you're using physics in your game, it will be very helpful to understand the different basic Collider types, their common uses, and how they interact with other types of objects. Unity中有許多不同的碰撞組合。每個(gè)游戲都很獨(dú)特,不同的組合可能更好地適用于不同類型的游戲。如果你在游戲中使用了物理效果,那理解不同的基本碰撞類型會(huì)很有幫助,包括它們的常用形式及如何和其他類型的對(duì)象作用。 Static Collider 靜態(tài)碰撞器These are GameObjects that do not have a Rigidbody attached, but do have a Collider attached. These objects should remain still, or move very little. These work great for your environment geometry. They will not move if a Rigidbody collides with them. 指的是沒(méi)有附加剛體而附加了碰撞器的游戲?qū)ο蟆_@類對(duì)象會(huì)保持靜止或者很輕微的移動(dòng)。對(duì)于環(huán)境模型十分好用,當(dāng)和剛體碰撞時(shí)而不會(huì)移動(dòng)。 Rigidbody Collider 剛體碰撞器These GameObjects contain both a Rigidbody and a Collider. They are completely affected by the physics engine through scripted forces and collisions. They might collide with a GameObject that only contains a Collider. These will likely be your primary type of Collider in games that use physics. 指的是同時(shí)附加了剛體和碰撞器的游戲?qū)ο。通過(guò)腳本的力量和碰撞完全受物理引擎的影響?梢院椭话鲎财鞯挠螒?qū)ο笈鲎。將?huì)成為你游戲中使用物理效果的基本類型碰撞器。 Kinematic Rigidbody Collider 運(yùn)動(dòng)學(xué)剛體碰撞器This GameObject contains a Collider and a Rigidbody which is marked IsKinematic. To move this GameObject, you modify its Transform Component, rather than applying forces. They're similar to Static Colliders but will work better when you want to move the Collider around frequently. There are some other specialized scenarios for using this GameObject. 指的是同時(shí)包含碰撞器和剛體,并且激活I(lǐng)sKinematic的一類游戲?qū)ο螅苿?dòng)這類游戲?qū)ο,要修改它的Transform組件,而不是用力。它們很像靜態(tài)碰撞器不過(guò)對(duì)于想要不停地到處移動(dòng)的碰撞器很好用。這類游戲?qū)ο筮有許多其他的獨(dú)特使用情景。 This object can be used for circumstances in which you would normally want a Static Collider to send a trigger event. Since a Trigger must have a Rigidbody attached, you should add a Rigidbody, then enable IsKinematic. This will prevent your Object from moving from physics influence, and allow you to receive trigger events when you want to. 這類對(duì)象可以用于你通常希望用靜態(tài)碰撞器發(fā)出觸發(fā)事件的情形下。因?yàn)橛|發(fā)器必須要有剛體,你應(yīng)該添加剛體然后啟用IsKinematic。這會(huì)阻止你的對(duì)象因物理作用而移動(dòng)并且允許接收你希望得到的觸發(fā)事件。 Kinematic Rigidbodies can easily be turned on and off. This is great for creating ragdolls, when you normally want a character to follow an animation, then turn into a ragdoll when a collision occurs, prompted by an explosion or anything else you choose. When this happens, simply turn all your Kinematic Rigidbodies into normal Rigidbodies through scripting. 運(yùn)動(dòng)學(xué)剛體啟用與否很容易控制。這對(duì)創(chuàng)建人偶十分適用,通常,當(dāng)你希望一個(gè)角色依照動(dòng)畫活動(dòng),然后由于爆炸或者其他你選擇的情況而引起的碰撞導(dǎo)致其變?yōu)槿伺。這種情況下,很簡(jiǎn)單,只需要通過(guò)腳本將運(yùn)動(dòng)學(xué)剛體改為普通剛體。 If you have Rigidbodies come to rest so they are not moving for some time, they will "fall asleep". That is, they will not be calculated during the physics update since they are not going anywhere. If you move a Kinematic Rigidbody out from underneath normal Rigidbodies that are at rest on top of it, the sleeping Rigidbodies will "wake up" and be correctly calculated again in the physics update. So if you have a lot of Static Colliders that you want to move around and have different object fall on them correctly, use Kinematic Rigidbody Colliders. 如果有剛體有時(shí)候變得靜止不動(dòng)了,那么它們就是進(jìn)入休眠了。意味著它們將不受物理變化影響,也就不會(huì)移動(dòng)。如果你把一個(gè)運(yùn)動(dòng)學(xué)剛體從一個(gè)休眠的普通剛體下邊移走,那休眠的剛體就會(huì)被喚醒并重新被物理變化時(shí)時(shí)影響。所以如果你有許多希望四處移動(dòng)并有不同的對(duì)象要恰好砸到它們的靜態(tài)碰撞器,那就用運(yùn)動(dòng)學(xué)剛體碰撞器吧。 Collision action matrix 碰撞行為矩陣Depending on the configurations of the two colliding Objects, a number of different actions can occur. The chart below outlines what you can expect from two colliding Objects, based on the components that are attached to them. Some of the combinations only cause one of the two Objects to be affected by the collision, so keep the standard rule in mind - physics will not be applied to objects that do not have Rigidbodies attached. 基于兩個(gè)碰撞對(duì)象的配置,可以產(chǎn)生很多不同的效果。下表概括了基于附加不同組件的兩個(gè)碰撞對(duì)象所產(chǎn)生的效果。其中有些組合只能導(dǎo)致碰撞的兩個(gè)對(duì)象中的一個(gè)受到影響,.所以考慮到保持標(biāo)準(zhǔn)的規(guī)則-物理效果將不會(huì)對(duì)沒(méi)有附加剛體的對(duì)象生效。
Layer-Based Collision Detection 基于層的碰撞檢測(cè)In Unity 3.x we introduce something called Layer-Based Collision Detection, and is that you can now selectively tell Unity GameObjects to collide with specific layers they are attached to. For more info, you can click here 在Unity3以后版本,我們介紹了一種稱為"基于層的碰撞檢測(cè)"(Layer-Based Collision Detection)的東西,可以讓你有選擇地控制Unity對(duì)象和他們附加的特定層碰撞。點(diǎn)擊此處獲取更多信息。 贊0 踩0 |
未知用戶
2005-2025 朱峰社區(qū) 版權(quán)所有 遼ICP備2021001865號(hào)-1
2005-2025 ZhuFeng Community All Rights Reserved
VIP