public bool isTouching(PhysicObj obj) { AdditionalFixtureData fixData; foreach (Fixture fix in body.FixtureList) { fixData = (AdditionalFixtureData)fix.UserData; if (fixData.isTouching == true) { foreach (Fixture fixtureTouching in fixData.fixInContactList) { if (((AdditionalFixtureData)fixtureTouching.UserData).physicParent.Equals(obj)) { return(true); } } } } return(false); }
private bool isCollisionPossibleByHeight(Fixture f1, Fixture f2) { if ((AdditionalFixtureData)f1.UserData == null || (AdditionalFixtureData)f2.UserData == null) { return(true); } PhysicObj p1 = ((AdditionalFixtureData)f1.UserData).physicParent; PhysicObj p2 = ((AdditionalFixtureData)f2.UserData).physicParent; float p1Top = p1.height + p1.length; float p1Down = p1.height; float p2Top = p2.height + p2.length; float p2Down = p2.height; if (p1Top < p2Down || p2Top < p1Down) { return(false); } return(true); }
private float distanceWithPhysicObj(PhysicObj obj) { if (obj == null) { return(-1); } Fixture proxyAfix = owner.getBoundsFixture(); Fixture proxyBfix = obj.getBoundsFixture(); if (proxyAfix == null || proxyBfix == null) { return(-1); } DistanceProxy proxyA = new DistanceProxy(); proxyA.Set(proxyAfix.Shape, 0); DistanceProxy proxyB = new DistanceProxy(); proxyB.Set(proxyBfix.Shape, 1); DistanceInput distInput = new DistanceInput(); distInput.ProxyA = proxyA; distInput.ProxyB = proxyB; Transform transformA; owner.body.GetTransform(out transformA); Transform transformB; obj.body.GetTransform(out transformB); distInput.TransformA = transformA; distInput.TransformB = transformB; DistanceOutput distout = new DistanceOutput(); SimplexCache simplexCache = new SimplexCache(); Distance.ComputeDistance(out distout, out simplexCache, distInput); return(distout.Distance); }
public TextureHeadingToDirectionComponent(PhysicObj obj) { owner = obj; }
public GenerateProjectileComponent(PhysicObj obj) { rnd = new Random(); owner = obj; }
public void changeTarget(PhysicObj target) { this.target = target; }