我已经附加了一个脚本到预制件,脚本是:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class destroyer: MonoBehaviour {
Circles circles;
Collider2D collider1;
Collider2D collider2;
private void Start() {
collider1 = gameObject.transform.Ge
我正在评估iOS SpriteKit物理引擎,为了测试,我用Xcode创建了一个简单的场景,其中包含两个圆形节点:
这两个节点都有圆形的物理体,质量为5千克。我使用SKPhysicsJointSpring连接这两个节点。下面是整个设置(在viewDidLoad()中):
let path = NSBundle.mainBundle().pathForResource("MyScene", ofType: "sks")!
let scene = NSKeyedUnarchiver.unarchiveObjectWithFile(path) as! SKS
我目前正在尝试在Unity中创建一个2D游戏,我的玩家在他的上半部分有一个盒子对撞器,在他的下半部分有一个圆形对撞器;这使得坡道和东西变得平滑。 当我收集一块宝石时,我的OnTriggerEnter函数会调用两次,因为我的两个碰撞器都是如此,除非我是从上面掉到它上面,或者从下面跳到它上面,因为一个碰撞器明显比另一个碰撞器先接触到它。 有没有办法将对撞机合并到一个检查中,使它们不会重叠? The box and circle colliders The OnTriggerEnter2D function