本文整理汇总了C#中HkRigidBody.GetEntity方法的典型用法代码示例。如果您正苦于以下问题:C# HkRigidBody.GetEntity方法的具体用法?C# HkRigidBody.GetEntity怎么用?C# HkRigidBody.GetEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HkRigidBody
的用法示例。
在下文中一共展示了HkRigidBody.GetEntity方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: phantom_EnterConnector
private void phantom_EnterConnector(HkPhantomCallbackShape shape, HkRigidBody body)
{
var other = body.GetEntity() as MyCubeGrid;
if (other == null || other == this.CubeGrid)
return;
m_detectedGrids.Add(other);
}
示例2: phantom_LeaveEjector
private void phantom_LeaveEjector(HkPhantomCallbackShape shape, HkRigidBody body)
{
var updateEmissivity = (m_detectedFloaters.Count == 2);
m_detectedFloaters.Remove(body.GetEntity());
if (updateEmissivity)
UpdateEmissivity();
}
示例3: phantom_EnterEjector
private void phantom_EnterEjector(HkPhantomCallbackShape shape, HkRigidBody body)
{
var entity = body.GetEntity();
Debug.Assert(entity is MyFloatingObject);
if (entity is MyFloatingObject)
{
var updateEmissivity = (m_detectedFloaters.Count == 1);
m_detectedFloaters.Add(entity);
if (updateEmissivity)
UpdateEmissivity();
}
}
示例4: phantom_Enter
private void phantom_Enter(HkPhantomCallbackShape shape, HkRigidBody body)
{
var other = body.GetEntity() as MyCubeGrid;
if (other == null || other.GridSizeEnum != CubeGrid.GridSizeEnum || other == this.CubeGrid)
return;
m_gridList.Add(other);
}
示例5: Attach
private void Attach(HkRigidBody body, Vector3 gearSpacePivot, Matrix otherBodySpacePivot)
{
if (CubeGrid.Physics.Enabled)
{
var entity = body.GetEntity();
Debug.Assert(m_attachedTo == null, "Already attached");
Debug.Assert(entity != null, "Landing gear is attached to body which has no entity");
Debug.Assert(m_constraint == null);
if (m_attachedTo != null || entity == null || m_constraint != null)
return;
body.Activate();
CubeGrid.Physics.RigidBody.Activate();
m_attachedTo = entity;
if (entity != null)
{
entity.OnPhysicsChanged += m_physicsChangedHandler;
}
this.OnPhysicsChanged += m_physicsChangedHandler;
Matrix gearLocalSpacePivot = Matrix.Identity;
gearLocalSpacePivot.Translation = gearSpacePivot;
var fixedData = new HkFixedConstraintData();
if (MyFakes.OVERRIDE_LANDING_GEAR_INERTIA)
{
fixedData.SetInertiaStabilizationFactor(MyFakes.LANDING_GEAR_INTERTIA);
}
else
{
fixedData.SetInertiaStabilizationFactor(1);
}
fixedData.SetSolvingMethod(HkSolvingMethod.MethodStabilized);
fixedData.SetInBodySpace(ref gearLocalSpacePivot, ref otherBodySpacePivot);
HkConstraintData data = fixedData;
if (MyFakes.LANDING_GEAR_BREAKABLE && BreakForce < MaxSolverImpulse)
{
var breakData = new HkBreakableConstraintData(fixedData);
fixedData.Dispose();
breakData.Threshold = BreakForce;
breakData.ReapplyVelocityOnBreak = true;
breakData.RemoveFromWorldOnBrake = true;
data = breakData;
}
if (!m_needsToRetryLock)
StartSound(m_lockSound);
m_constraint = new HkConstraint(CubeGrid.Physics.RigidBody, body, data);
CubeGrid.Physics.AddConstraint(m_constraint);
m_constraint.Enabled = true;
LockMode = LandingGearMode.Locked;
if (CanAutoLock)
ResetAutolock();
OnConstraintAdded(GridLinkTypeEnum.Physical, entity);
OnConstraintAdded(GridLinkTypeEnum.NoContactDamage, entity);
var handle = StateChanged;
if (handle != null) handle(true);
}
}
示例6: phantom_Leave
void phantom_Leave(HkPhantomCallbackShape sender, HkRigidBody body)
{
VRage.ProfilerShort.Begin("GravityLeave");
var entity = body.GetEntity(0);// jn: TODO we should collect bodies not entities
lock (m_locker)
{
if (entity != null)
{
m_containedEntities.Remove(entity);
MyTrace.Send(TraceWindow.EntityId, string.Format("Entity left gravity field, entity: {0}", entity));
}
}
VRage.ProfilerShort.End();
}
示例7: phantom_Enter
void phantom_Enter(HkPhantomCallbackShape sender, HkRigidBody body)
{
VRage.ProfilerShort.Begin("GravityEnter");
var entity = body.GetEntity(0);// jn: TODO we should collect bodies not entities
// HACK: disabled gravity for ships (there may be more changes so I won't add Entity.RespectsGravity now)
lock (m_locker)
{
if (entity != null && !(entity is MyCubeGrid))
{
MyTrace.Send(TraceWindow.EntityId, string.Format("Entity entered gravity field, entity: {0}", entity));
m_containedEntities.Add(entity);
if (entity.Physics.HasRigidBody)
((MyPhysicsBody)entity.Physics).RigidBody.Activate();
}
}
VRage.ProfilerShort.End();
}
示例8: phantom_Enter
private void phantom_Enter(HkPhantomCallbackShape shape, HkRigidBody body)
{
if (!Sync.IsServer)
return;
var entity = body.GetEntity();
if (entity is MyFloatingObject)
{
m_entitiesToTake.Add(entity as MyFloatingObject);
NeedsUpdate |= MyEntityUpdateEnum.BEFORE_NEXT_FRAME;
}
//if (!Sync.IsServer)
// return;
//var entity = body.GetEntity();
//if (entity is MyFloatingObject)
//{
// m_inventory.TakeFloatingObject(entity as MyFloatingObject);
//}
}
示例9: phantom_Leave
private void phantom_Leave(HkPhantomCallbackShape shape, HkRigidBody body)
{
if (!Sync.IsServer)
return;
var entity = body.GetEntity();
if (m_entitiesToTake.Contains(entity))
{
m_entitiesToTake.Remove(entity as MyFloatingObject);
}
}
示例10: phantom_Leave
void phantom_Leave(HkPhantomCallbackShape sender, HkRigidBody body)
{
var entity = body.GetEntity();
lock (m_locker)
{
if (entity != null)
{
m_containedEntities.Remove(entity);
MyTrace.Send(TraceWindow.EntityId, string.Format("Entity left gravity field, entity: {0}", entity));
}
}
}