private void MoveObject(SimulationEvent e) { //AD: Inserted a return here as all motion logic lives in the DIS adapter now. return; //TODO: adjust heading (current, expected, delta) //use radius math to calculate turn radius //objectProxies = bbClient.GetObjectProxies(); DataValue dv = null; string id = ((StringValue)e["ObjectID"]).value; SimulationObjectProxy obProx = objectProxies[id]; double throttle = 0; double maxSpeed = 0; double speedMultiplier = 0; Vec3D curVec = new Vec3D(0, 0, 0); Vec3D destVec = new Vec3D(0, 0, 0); Vec3D velVec = new Vec3D(0, 0, 0); dv = obProx["Location"].GetDataValue(); curVec.Set((LocationValue)dv); dv = obProx["MaximumSpeed"].GetDataValue(); maxSpeed = ((DoubleValue)dv).value; dv = e["DestinationLocation"]; destVec.Set((LocationValue)dv); obProx["DestinationLocation"].SetDataValue(dv); dv = e["Throttle"]; throttle = ((DoubleValue)dv).value; obProx["Throttle"].SetDataValue(dv); dv = obProx["ActiveRegionSpeedMultiplier"].GetDataValue(); speedMultiplier = ((DoubleValue)dv).value; velVec = curVec.VectorDistanceTo(destVec); velVec.Normalize(); velVec = velVec.Multiply(maxSpeed * throttle * speedMultiplier); obProx["Velocity"].SetDataValue(velVec.ToVelocityValue()); // System.Console.WriteLine("Object {0} Velocity={1}", id.ToString(), velVec.ToString()); }
private void MoveObject(SimulationEvent e) { //objectProxies = bbClient.GetObjectProxies(); DataValue dv = null; string id = ((StringValue)e["ObjectID"]).value; SimulationObjectProxy obProx = objectProxies[id]; double throttle = 0; double maxSpeed = 0; double speedMultiplier = 0; Vec3D curVec = new Vec3D(0, 0, 0); Vec3D destVec = new Vec3D(0, 0, 0); Vec3D velVec = new Vec3D(0, 0, 0); dv = obProx["Location"].GetDataValue(); curVec.Set((LocationValue)dv); dv = obProx["MaximumSpeed"].GetDataValue(); maxSpeed = ((DoubleValue)dv).value; dv = e["DestinationLocation"]; destVec.Set((LocationValue)dv); obProx["DestinationLocation"].SetDataValue(dv); dv = e["Throttle"]; throttle = ((DoubleValue)dv).value; obProx["Throttle"].SetDataValue(dv); dv = obProx["ActiveRegionSpeedMultiplier"].GetDataValue(); speedMultiplier = ((DoubleValue)dv).value; velVec = curVec.VectorDistanceTo(destVec); velVec.Normalize(); velVec = velVec.Multiply(maxSpeed * throttle * speedMultiplier); obProx["Velocity"].SetDataValue(velVec.ToVelocityValue()); // System.Console.WriteLine("Object {0} Velocity={1}", id.ToString(), velVec.ToString()); }
/* Vec3D FindLandBoundaryIntersection(Vec3D fromP, Vec3D toP) { Vec2D r = null; Vec2D myFromP = new Vec2D(fromP.X, fromP.Y); Vec2D myToP = new Vec2D(toP.X, toP.Y); List<Vec2D> points = new List<Vec2D>(); foreach (LandRegion reg in landRegions.Values) { r = Polygon2D.FindIntersect(reg.poly, myFromP, myToP); if (r != null) { points.Add(r); } } if (points.Count == 0) { return null; } Vec2D closest = new Vec2D(points[0]); foreach (Vec2D p in points) { if (myFromP.ScalerDistanceTo(p) < myFromP.ScalerDistanceTo(closest)) { closest.Set(p); } } // return point on from side of intersection. if (myFromP.X < closest.X) { closest.X -= 1; } else if (myFromP.X > closest.X) { closest.X += 1; } if (myFromP.Y < closest.Y) { closest.Y -= 1; } else if (myFromP.Y > closest.Y) { closest.Y += 1; } return new Vec3D(closest.X, closest.Y, fromP.Z); } */ /* Vec3D FindObstructionBoundaryIntersection(Vec3D fromP, Vec3D toP) { Vec3D r = null; List<Vec3D> points = new List<Vec3D>(); foreach (BlockingRegion reg in blockingRegions.Values) { r = Polygon3D.FindIntersect(reg.poly, fromP, toP); if (r != null) { points.Add(r); } } if (points.Count == 0) { return null; } Vec3D closest = new Vec3D(points[0]); foreach (Vec3D p in points) { if (fromP.ScalerDistanceTo(p) < fromP.ScalerDistanceTo(closest)) { closest.Set(p); } } // return point on from side of intersection. if (fromP.X < closest.X) { closest.X -= 1; } else if (fromP.X > closest.X) { closest.X += 1; } if (fromP.Y < closest.Y) { closest.Y -= 1; } else if (fromP.Y > closest.Y) { closest.Y += 1; } return closest; } */ private void TimeTick(SimulationEvent e) { int oldTime = time; DataValue dv = null; Vec3D landIntersect; Vec3D obstructionIntersect; Vec3D curLocVec = new Vec3D(0, 0, 0); Vec3D newLocVec = new Vec3D(0, 0, 0); Vec3D destVec = new Vec3D(0, 0, 0); Vec3D velVec = new Vec3D(0, 0, 0); dv = e["Time"]; time = ((IntegerValue)dv).value; double dTime = ((double)(time - oldTime)) / 1000; SimulationObjectProxy obProx = null; SimulationObjectProxy parentProx = null; bool launchStarted, launchDone; int launchEndTime; bool pursueStarted; string pursueTargetID; string parentObjectID; ScoringDB.ActorFrame actorFrame = new ScoringDB.ActorFrame(); foreach (string id in objectProxies.Keys) { obProx = objectProxies[id]; //********************************* // Launch movement logic //********************************* launchStarted = ((BooleanValue)obProx["LaunchStarted"].GetDataValue()).value; launchDone = ((BooleanValue)obProx["LaunchDone"].GetDataValue()).value; pursueStarted = ((BooleanValue)obProx["PursueStarted"].GetDataValue()).value; pursueTargetID = ((StringValue)obProx["PursueTargetID"].GetDataValue()).value; if (launchStarted == false && launchDone == true) { dv = obProx["LaunchDone"].GetDataValue(); ((BooleanValue)dv).value = false; obProx["LaunchDone"].SetDataValue(dv); launchDone = false; } if (launchStarted == true && launchDone == false) { parentObjectID = ((StringValue)obProx["ParentObjectID"].GetDataValue()).value; parentProx = objectProxies[parentObjectID]; launchEndTime = ((IntegerValue)obProx["LaunchEndTime"].GetDataValue()).value; if (time >= launchEndTime) { Vec3D parentVec = new Vec3D((LocationValue)parentProx["Location"].GetDataValue()); dv = obProx["LaunchDestinationLocation"].GetDataValue(); Vec3D launchDestVec = new Vec3D((LocationValue)dv); bool sendMoveRequest = ((LocationValue)dv).exists; obProx["Location"].SetDataValue(parentVec.ToLocationValue()); //Now that location has been updated, set in helper library: ObjectDistances.UpdateObjectLocation(id, parentVec); dv = obProx["LaunchDone"].GetDataValue(); ((BooleanValue)dv).value = true; obProx["LaunchDone"].SetDataValue(dv); if (sendMoveRequest) { string userID = ((StringValue)obProx["OwnerID"].GetDataValue()).value; distClient.PutEvent(SimUtility.BuildMoveObjectRequestEvent(ref simModel, time, userID, id, launchDestVec, 1.0)); } if (((BooleanValue)obProx["LaunchIsWeapon"].GetDataValue()).value == true) { dv = obProx["PursueStarted"].GetDataValue(); ((BooleanValue)dv).value = true; obProx["PursueStarted"].SetDataValue(dv); pursueStarted = true; dv = obProx["LaunchWeaponTargetID"].GetDataValue(); pursueTargetID = ((StringValue)dv).value; dv = obProx["PursueTargetID"].GetDataValue(); ((StringValue)dv).value = pursueTargetID; obProx["PursueTargetID"].SetDataValue(dv); distClient.PutEvent(SimUtility.BuildSystemMessageEvent(ref simModel, time, ((StringValue)(obProx["OwnerID"].GetDataValue())).value, id + " has been launched from " + parentObjectID + " at " + pursueTargetID)); distClient.PutEvent(SimUtility.BuildHistory_SubplatformLaunchEvent(ref simModel, time, id, parentObjectID, parentVec, launchDestVec, true, pursueTargetID)); } else { distClient.PutEvent(SimUtility.BuildSystemMessageEvent(ref simModel, time, ((StringValue)(obProx["OwnerID"].GetDataValue())).value, id + " has been undocked from " + parentObjectID)); distClient.PutEvent(SimUtility.BuildHistory_SubplatformLaunchEvent(ref simModel, time, id, parentObjectID, parentVec, launchDestVec, false, "")); } } } if (pursueStarted) { if (objectProxies.ContainsKey(pursueTargetID)) { dv = objectProxies[pursueTargetID]["Location"].GetDataValue(); String targetState = ((StringValue)objectProxies[pursueTargetID]["State"].GetDataValue()).value; if (!((LocationValue)dv).exists || targetState == "Dead") { //if my target is dead or not existant, kill this weapon too. obProx["PursueStarted"].SetDataValue(DataValueFactory.BuildBoolean(false)); obProx["PursueTargetID"].SetDataValue(DataValueFactory.BuildString(String.Empty)); distClient.PutEvent(SimUtility.BuildStateChangeEvent(ref simModel, time, id, "Dead")); continue; } destVec.Set((LocationValue)dv); obProx["DestinationLocation"].SetDataValue(destVec.ToLocationValue()); dv = obProx["Throttle"].GetDataValue(); ((DoubleValue)dv).value = 1; obProx["Throttle"].SetDataValue(dv); distClient.PutEvent(SimUtility.BuildHistory_PursueEvent(ref simModel, time, id, curLocVec, pursueTargetID, destVec)); } } //********************************* // MoveObject logic //********************************* // // Ignore objects that don't have a location // dv = obProx["Location"].GetDataValue(); if (!((LocationValue)dv).exists) { continue; } curLocVec.Set((LocationValue)dv); //dv = obProx["Velocity"].GetDataValue(); //velVec.Set((VelocityValue)dv); dv = obProx["DestinationLocation"].GetDataValue(); if (!((LocationValue)dv).exists) { destVec.Set(curLocVec); obProx["DestinationLocation"].SetDataValue(destVec.ToLocationValue()); } else { destVec.Set((LocationValue)dv); } dv = obProx["Throttle"].GetDataValue(); double throttle = ((DoubleValue)dv).value; dv = obProx["MaximumSpeed"].GetDataValue(); double maxSpeed = ((DoubleValue)dv).value; // // If the object's throttle or maximum speed are zero, set velocity to (0,0,0) and // set the destination to the current location // if (throttle == 0 || maxSpeed == 0 || ((StringValue)obProx["State"].GetDataValue()).value == "Dead") { velVec.Set(0, 0, 0); obProx["Velocity"].SetDataValue(velVec.ToVelocityValue()); destVec.Set(curLocVec); obProx["DestinationLocation"].SetDataValue(destVec.ToLocationValue()); dv = obProx["Throttle"].GetDataValue(); ((DoubleValue)dv).value = 0; obProx["Throttle"].SetDataValue(dv); } // // Update what active regions the object is in. // StateDB.physicalObjects[id].activeRegions = GetActiveRegions(curLocVec); dv = obProx["InActiveRegions"].GetDataValue(); StateDB.physicalObjects[id].activeRegions.Remove(id);// dont want to be blocked by itself. ((StringListValue)dv).strings = StateDB.physicalObjects[id].activeRegions; obProx["InActiveRegions"].SetDataValue(dv); double speedMultiplier = GetActiveRegionSpeedMultiplier(StateDB.physicalObjects[id].activeRegions); dv = obProx["ActiveRegionSpeedMultiplier"].GetDataValue(); if (((DoubleValue)dv).value != speedMultiplier) { ((DoubleValue)dv).value = speedMultiplier; obProx["ActiveRegionSpeedMultiplier"].SetDataValue(dv); //distClient.PutEvent(SimUtility.BuildActiveRegionSpeedMultiplierUpdateEvent(ref simModel, time, id)); distributor.viewProBackChannelEvents.Add(SimUtility.BuildActiveRegionSpeedMultiplierUpdateEvent(ref simModel, time, id)); } if (time % 1000 == 0) { actorFrame.objectID = id; actorFrame.speciesName = StateDB.physicalObjects[id].speciesName; actorFrame.ownerID = StateDB.physicalObjects[id].ownerID; actorFrame.activeRegions = StateDB.physicalObjects[id].activeRegions; ScoringDB.UpdateScore_ObjectExists(actorFrame); } // // Update the object's velocity based on its destinations, throttle, and maximum speed. // if (curLocVec.ScalerDistanceTo(destVec) > 0.01) { if (curLocVec.ScalerDistanceTo(destVec) >= (maxSpeed * throttle * dTime * speedMultiplier)) { velVec = curLocVec.VectorDistanceTo(destVec); velVec.Normalize(); velVec = velVec.Multiply(maxSpeed * throttle * speedMultiplier); } else { velVec = destVec.Subtract(curLocVec); } obProx["Velocity"].SetDataValue(velVec.ToVelocityValue()); // // Update the object's location based on its velocity // newLocVec.X = curLocVec.X + (velVec.X * dTime); newLocVec.Y = curLocVec.Y + (velVec.Y * dTime); newLocVec.Z = curLocVec.Z + (velVec.Z * dTime); // TODO: Do obstruction check here /* obstructionIntersect = FindObstructionBoundaryIntersection(curLocVec, newLocVec); landIntersect = FindLandBoundaryIntersection(curLocVec, newLocVec); if (obstructionIntersect != null) { curLocVec.Set(obstructionIntersect); obProx["Location"].SetDataValue(curLocVec.ToLocationValue()); destVec.Set(curLocVec); obProx["DestinationLocation"].SetDataValue(destVec.ToLocationValue()); distClient.PutEvent(SimUtility.BuildMoveDoneEvent(ref simModel, time, id)); dv = obProx["Throttle"].GetDataValue(); ((DoubleValue)dv).value = 0; obProx["Throttle"].SetDataValue(dv); } else if (landIntersect != null && (obProx.GetObjectType() != "AirObject")) { curLocVec.Set(landIntersect); obProx["Location"].SetDataValue(curLocVec.ToLocationValue()); destVec.Set(curLocVec); obProx["DestinationLocation"].SetDataValue(destVec.ToLocationValue()); distClient.PutEvent(SimUtility.BuildMoveDoneEvent(ref simModel, time, id)); dv = obProx["Throttle"].GetDataValue(); ((DoubleValue)dv).value = 0; obProx["Throttle"].SetDataValue(dv); } else { curLocVec.Set(newLocVec); obProx["Location"].SetDataValue(curLocVec.ToLocationValue()); } */ bool stopMotion = false; switch (obProx.GetObjectType()) { case "SeaObject": if (!IsOnSea(newLocVec)) { stopMotion = true; distClient.PutEvent(SimUtility.BuildSystemMessageEvent(ref simModel, time, ((StringValue)(obProx["OwnerID"].GetDataValue())).value, id + " has been blocked by land")); } break; case "LandObject": if (!IsOnLand(newLocVec)) { stopMotion = true; distClient.PutEvent(SimUtility.BuildSystemMessageEvent(ref simModel, time, ((StringValue)(obProx["OwnerID"].GetDataValue())).value, id + " has been blocked by sea")); } break; default: break; } if (IsObstructed(curLocVec, newLocVec,id)) { stopMotion = true; //distClient.PutEvent(SimUtility.BuildSystemMessageEvent(ref simModel, // time, // ((StringValue)(obProx["OwnerID"].GetDataValue())).value, // id + " has been blocked by an obstruction")); } if (!stopMotion) { curLocVec.Set(newLocVec); obProx["Location"].SetDataValue(curLocVec.ToLocationValue()); //Now that location has been updated, set in helper library: ObjectDistances.UpdateObjectLocation(id, curLocVec); } else { obProx["Location"].SetDataValue(curLocVec.ToLocationValue()); //Now that location has been updated, set in helper library: ObjectDistances.UpdateObjectLocation(id, curLocVec); destVec.Set(curLocVec); obProx["DestinationLocation"].SetDataValue(destVec.ToLocationValue()); distClient.PutEvent(SimUtility.BuildMoveDoneEvent(ref simModel, time, id, "Obstruction")); distributor.viewProBackChannelEvents.Add(SimUtility.BuildMoveDoneEvent(ref simModel, time, id, "Obstruction")); dv = obProx["Throttle"].GetDataValue(); ((DoubleValue)dv).value = 0; obProx["Throttle"].SetDataValue(dv); distClient.PutEvent(SimUtility.BuildSystemMessageEvent(ref simModel, time, ((StringValue)(obProx["OwnerID"].GetDataValue())).value, id + " was stopped by an obstruction")); } } else // if the object has reached its destination and is not pursuing, send MoveDone { velVec.Set(0, 0, 0); newLocVec.Set(destVec); obProx["Location"].SetDataValue(newLocVec.ToLocationValue()); //Now that location has been updated, set in helper library: ObjectDistances.UpdateObjectLocation(id, newLocVec); obProx["Velocity"].SetDataValue(velVec.ToVelocityValue()); if (!pursueStarted && throttle > 0) { /* TODO: Make sure MoveDone is being sent correctly.*/ distClient.PutEvent(SimUtility.BuildMoveDoneEvent(ref simModel, time, id, "ReachedDestination")); distributor.viewProBackChannelEvents.Add(SimUtility.BuildMoveDoneEvent(ref simModel, time, id, "ReachedDestination")); dv = obProx["Throttle"].GetDataValue(); ((DoubleValue)dv).value = 0; obProx["Throttle"].SetDataValue(dv); distClient.PutEvent(SimUtility.BuildSystemMessageEvent(ref simModel, time, ((StringValue)(obProx["OwnerID"].GetDataValue())).value, id + " has reached its destination")); } } /* TODO: Ignore obstruction code for now */ /* if (((StringValue)obProx["State"].GetDataValue()).value != "Dead" && ((obProx.GetObjectType() == "LandObject" && !IsOnLand(newLocVec)) || (obProx.GetObjectType() == "SeaObject" && !IsOnSea(newLocVec)) || IsObstructed(curLocVec,newLocVec) || IsInObstruction(newLocVec))) { velVec.Set(0, 0, 0); dv = obProx["Velocity"].GetDataValue(); obProx["Velocity"].SetDataValue(velVec.ToVelocityValue()); SimulationEvent done = SimulationEventFactory.BuildEvent(ref simModel, "MoveDone"); ((IntegerValue)done["Time"]).value = time; ((StringValue)done["ObjectID"]).value = id; distClient.PutEvent(done); System.Console.WriteLine("Motion: object {0} stopped by land boundery", id); dv = obProx["Throttle"].GetDataValue(); ((DoubleValue)dv).value = 0; obProx["Throttle"].SetDataValue(dv); if (((obProx.GetObjectType() == "LandObject" && !IsOnLand(curLocVec)) || obProx.GetObjectType() == "SeaObject" && !IsOnSea(curLocVec)) || IsInObstruction(curLocVec)) { SimulationEvent dead = SimulationEventFactory.BuildEvent(ref simModel, "StateChange"); ((IntegerValue)dead["Time"]).value = time; ((StringValue)dead["ObjectID"]).value = id; ((StringValue)dead["NewState"]).value = "Dead"; distClient.PutEvent(dead); } return; } * */ } }
private void TimeTick(SimulationEvent e) { int oldTime = time; DataValue dv = null; //Vec3D curVec = new Vec3D(0, 0, 0); //Vec3D destVec = new Vec3D(0, 0, 0); //Vec3D velVec = new Vec3D(0, 0, 0); Vec3D loc1 = new Vec3D(0, 0, 0); Vec3D loc2 = new Vec3D(0, 0, 0); Vec3D next1 = new Vec3D(0, 0, 0); Vec3D next2 = new Vec3D(0, 0, 0); Vec3D vel1 = new Vec3D(0, 0, 0); Vec3D vel2 = new Vec3D(0, 0, 0); dv = e["Time"]; time = ((IntegerValue)dv).value; double dTime = ((double)(time - oldTime)) / 1000; SimulationObjectProxy obProx1 = null; SimulationObjectProxy obProx2 = null; List<string> ids = new List<string>(objectProxies.Keys); string id1; SimulationEvent collision = null; double distance; double? d; while (ids.Count > 0) { id1 = ids[0]; ids.Remove(id1); foreach (string id2 in ids) { d = ObjectDistances.GetScalarDistanceBetweenObjects(id1, id2); if (d == null) { // Don't look for collisions if they aren't on the screen continue; } distance = d.Value; double objectSize1 = 0; double objectSize2 = 0; obProx1 = objectProxies[id1]; obProx2 = objectProxies[id2]; //// Don't look for collisions if they aren't on the screen dv = obProx1["Location"].GetDataValue(); //if (!((LocationValue)dv).exists) //{ // continue; //} loc1.Set((LocationValue)dv); dv = obProx2["Location"].GetDataValue(); //if (!((LocationValue)dv).exists) //{ // continue; //} loc2.Set((LocationValue)dv); if (((BooleanValue)obProx1["DockedToParent"].GetDataValue()).value) { continue; } if (((BooleanValue)obProx2["DockedToParent"].GetDataValue()).value) { continue; } // Don't look for collisions if they are owned by the same player if (StateDB.physicalObjects[id1].ownerID == StateDB.physicalObjects[id2].ownerID) { continue; } // Don't look for collisions if they are on the same team if (StateDB.physicalObjects[id1].teamName == StateDB.physicalObjects[id2].teamName) { continue; } //Don't look for collisions if they are not hostile if (StateDB.teams.ContainsKey(StateDB.physicalObjects[id1].teamName) && StateDB.teams.ContainsKey(StateDB.physicalObjects[id2].teamName)) { if (!StateDB.teams[StateDB.physicalObjects[id1].teamName].hostility.Contains(StateDB.teams[StateDB.physicalObjects[id2].teamName].id) && !StateDB.teams[StateDB.physicalObjects[id2].teamName].hostility.Contains(StateDB.teams[StateDB.physicalObjects[id1].teamName].id)) {//only continue if both teams are not hostile to one another continue; } } CapabilityValue.Effect eff = null; // check ranges and add objects to target lists for self defense sim CapabilityValue cap1 = ((CapabilityValue)obProx1["Capability"].GetDataValue()); VulnerabilityValue vul1 = ((VulnerabilityValue)obProx1["Vulnerability"].GetDataValue()); CapabilityValue cap2 = ((CapabilityValue)obProx2["Capability"].GetDataValue()); VulnerabilityValue vul2 = ((VulnerabilityValue)obProx2["Vulnerability"].GetDataValue()); //double distance = loc1.ScalerDistanceTo(loc2); eff = SimUtility.FindCapabilityEffect(cap1, vul2); dv = obProx1["TargetsInRange"].GetDataValue(); //AD: TODO need a "TargetsInSensorRange"? which can drive the ViewPro loops if (eff != null && distance <= eff.range && ((StringValue)obProx2["State"].GetDataValue()).value != "Dead") { if (!((StringListValue)dv).strings.Contains(id2)) { ((StringListValue)dv).strings.Add(id2); } } else { if (((StringListValue)dv).strings.Contains(id2)) { ((StringListValue)dv).strings.Remove(id2); } } obProx1["TargetsInRange"].SetDataValue(dv); eff = SimUtility.FindCapabilityEffect(cap2, vul1); dv = obProx2["TargetsInRange"].GetDataValue(); if (eff != null && distance <= eff.range && ((StringValue)obProx1["State"].GetDataValue()).value != "Dead") { if (!((StringListValue)dv).strings.Contains(id1)) { ((StringListValue)dv).strings.Add(id1); } } else { if (((StringListValue)dv).strings.Contains(id1)) { ((StringListValue)dv).strings.Remove(id1); } } obProx2["TargetsInRange"].SetDataValue(dv); // Don't look for collisions if they are dead if (((StringValue)obProx1["State"].GetDataValue()).value == "Dead") { continue; } if (((StringValue)obProx2["State"].GetDataValue()).value == "Dead") { continue; } // Don't look for collisions if they are too small to collide dv = obProx1["Size"].GetDataValue(); objectSize1 = ((DoubleValue)dv).value; if (objectSize1 <= 0.000001) { continue; } dv = obProx2["Size"].GetDataValue(); objectSize2 = ((DoubleValue)dv).value; if (objectSize2 <= 0.000001) { continue; } dv = obProx1["Velocity"].GetDataValue(); vel1.Set((VelocityValue)dv); dv = obProx2["Velocity"].GetDataValue(); vel2.Set((VelocityValue)dv); if (vel1.X == 0 && vel2.X == 0 && vel1.Y == 0 && vel2.Y == 0 && vel1.Z == 0 && vel2.Z == 0) continue; next1 = loc1.Add(vel1.Multiply(dTime)); next2 = loc2.Add(vel2.Multiply(dTime)); if (next1.ScalerDistanceTo(next2) < (objectSize1 + objectSize2)) { collision = SimulationEventFactory.BuildEvent(ref simModel, "ObjectCollision"); ((StringValue)collision["ObjectID1"]).value = id1; ((StringValue)collision["ObjectID2"]).value = id2; ((IntegerValue)collision["Time"]).value = time; distClient.PutEvent(collision); } } } /*foreach (string id1 in objectProxies.Keys) { foreach (string id2 in objectProxies.Keys) { if (id1 == id2) { continue; } obProx1 = objectProxies[id1]; obProx2 = objectProxies[id1]; dv = obProx1["Location"].GetDataValue(); loc1.Set((LocationValue)dv); dv = obProx2["Location"].GetDataValue(); loc2.Set((LocationValue)dv); } }*/ }