コード例 #1
0
        public override void _OnEditorCommitVisual(CCommandList cmd, Graphics.CGfxCamera camera, GamePlay.SceneGraph.CheckVisibleParam param)
        {
            if (CEngine.PhysicsDebug == false)
            {
                return;
            }
            if (mDebugActor == null && mReady == false)
            {
                mReady = true;
                var test = CreateDefaultCapsule();

                test = SetMaterial();
            }

            if (mDebugActor != null)
            {
                float r          = 0.5f;
                float halfHeight = 0.5f;
                HostShape.IfGetCapsule(ref r, ref halfHeight);
                var trans = Placement.Transform * SocketMatrix * HostPlaceable.Placement.WorldMatrix;
                //mDebugActor.Placement.Location = RigidBody.Position;
                Vector3    scale, loc;//mDebugActor.Placement.Scale;
                Quaternion rotate;
                trans.Decompose(out scale, out rotate, out loc);
                var y = (r + halfHeight) * 2;
                scale.SetValue(scale.X * r * 2, scale.Y * y, scale.Z * r * 2);
                mDebugActor.Placement.Scale = scale;
            }
        }
コード例 #2
0
        protected override void RefreshShape()
        {
            if (HostShape != null)
            {
                HostShape.RemoveFraomActor();
            }
            var        mtl = CEngine.Instance.PhyContext.LoadMaterial(PhyMtlName);
            Vector3    worldLoc, worldScale;
            Quaternion worldQuat;

            HostPlaceable.Placement.WorldMatrix.Decompose(out worldScale, out worldQuat, out worldLoc);
            var shape = CEngine.Instance.PhyContext.CreateShapeCapsule(mtl, Radius * worldScale.X, HalfHeight * worldScale.X);

            if (shape == null)
            {
                return;
            }
            SetShapeData(shape);
            var relativePose = EngineNS.Bricks.PhysicsCore.PhyTransform.CreateTransform(Placement.Location * worldScale, Placement.Rotation);

            shape.AddToActor(this.RigidBody, ref relativePose);
            //shape.ShapeDesc = sd;
            HostShape = shape;
            //是否成为动态阻挡
            shape.AreaType = AreaType;
        }
コード例 #3
0
        public void SetBounds()
        {
            var capOrg = _hostShape.capOrgProvider();

            if (text != null)
            {
                text.SetPosForCluster(capOrg.X + textX,
                                      capOrg.Y + textY);
            }

            if (_freeDraw != null)
            {
                _freeDraw.SetPosForCluster(capOrg.X + freeDrawX,
                                           capOrg.Y + freeDrawY);
            }

            var btnOrg = HostShape.btnOrgProvider();

            //btn draw
            Canvas.SetLeft(btnDraw, btnOrg.X);
            Canvas.SetTop(btnDraw, btnOrg.Y);

            //btn type
            Canvas.SetLeft(btnType, btnOrg.X + 50);
            Canvas.SetTop(btnType, btnOrg.Y);
        }