Version: 2022.1
언어: 한국어
public PhysicsShapeType2D shapeType ;

설명

The shape type determines how the vertices and radius are used by this PhysicsShape2D.

Refer to the PhysicsShapeType2D documentation for more information about the different shape types.

using UnityEngine;
using UnityEngine.Assertions;

public class Example : MonoBehaviour { void Start() { // Create a shape group. var shapeGroup = new PhysicsShapeGroup2D();

// Add a Circle to the shape group. var circleShapeIndex = shapeGroup.AddCircle ( center: new Vector2(-2f, 3f), radius: 1f );

// Add a Capsule to the shape group. var capsuleShapeIndex = shapeGroup.AddCapsule ( vertex0: Vector2.down, vertex1: Vector2.up, radius: 0.5f );

// Fetch the shapes. var circleShape = shapeGroup.GetShape(circleShapeIndex); var capsuleShape = shapeGroup.GetShape(capsuleShapeIndex);

// Validate the shape types. Assert.AreEqual(PhysicsShapeType2D.Circle, circleShape.shapeType); Assert.AreEqual(PhysicsShapeType2D.Capsule, capsuleShape.shapeType); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961