本文整理汇总了C#中MinerWars.AppCode.Game.Entities.MyEntity.MoveAndRotate方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntity.MoveAndRotate方法的具体用法?C# MyEntity.MoveAndRotate怎么用?C# MyEntity.MoveAndRotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MinerWars.AppCode.Game.Entities.MyEntity
的用法示例。
在下文中一共展示了MyEntity.MoveAndRotate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEntity
public void UpdateEntity(MyEntity entity)
{
Vector3 position;
Quaternion rotation;
GetValues(m_time, out position, out rotation);
entity.MoveAndRotate(position, Matrix.CreateFromQuaternion(rotation));
}
示例2: UpdateTangent
public void UpdateTangent(MyEntity entity, Vector3 up)
{
Vector3 position0, position1;
Quaternion rotation0, rotation1;
GetValues(m_time - 0.05f, out position0, out rotation0);
GetValues(m_time + 0.05f, out position1, out rotation1);
Vector3 forward = position1 - position0;
if (!MyUtils.IsValid(forward))
{
forward = entity.WorldMatrix.Forward;
}
entity.MoveAndRotate((position0 + position1) / 2, Matrix.CreateWorld(Vector3.Zero, forward, up));
}
示例3: MoveAndRotateObject
/// <summary>
/// Moves and Rotates entity
/// </summary>
/// <param name="newPosition"></param>
/// <param name="newOrientation"></param>
/// <param name="entity"></param>
public static void MoveAndRotateObject(Vector3 newPosition, Matrix newOrientation, MyEntity entity)
{
BoundingSphere sphere = new BoundingSphere(newPosition + entity.LocalVolumeOffset, entity.WorldVolume.Radius);
if (MyMwcSectorConstants.SECTOR_SIZE_FOR_PHYS_OBJECTS_BOUNDING_BOX.Contains(sphere) == MinerWarsMath.ContainmentType.Contains)
{
Matrix entityBeforeMoveOrientation = entity.GetWorldRotation();
Vector3 entityBeforeMovePosition = entity.GetPosition();
if (entityBeforeMovePosition != newPosition || entityBeforeMoveOrientation != newOrientation)
{
// Move object
bool moveSuccesfull = entity.MoveAndRotate(newPosition, newOrientation);
Vector3 currentPosition = entity.GetPosition();
Matrix currentOrientation = entity.GetWorldRotation();
if (moveSuccesfull)
{
//entity.UpdateWorldMatrix();
// Play movement or rotation sounds
if (MyMinerGame.TotalGamePlayTimeInMilliseconds > m_delayMovementSoundInMillis)
{
if (entityBeforeMovePosition != currentPosition)
{
MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectMoveStep);
}
if (entityBeforeMoveOrientation != currentOrientation)
{
MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectRotateStep);
}
m_delayMovementSoundInMillis = MyMinerGame.TotalGamePlayTimeInMilliseconds + MyEditorConstants.DELAY_OBJECT_MOVEMENT_SOUND_IN_MILLIS;
}
MyEditor.Static.RecheckAllColidingEntitesAndClearNonColiding();//check all coliding entites to see if any went out of collision state
//MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("CheckAllCollidingObjectsForEntity");
// This was taking up to 170ms for 800 prefabs, so its replaced by void CheckCollisions(IEnumerable<MyEntity> entities) in HandleInput().
//MyEditor.Static.CheckAllCollidingObjectsForEntity(entity);//check all colliding state of entity after move
//MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
}
else
{
if (MyMinerGame.TotalGamePlayTimeInMilliseconds > m_delayMovementSoundInMillis)
{
if ((entityBeforeMovePosition != currentPosition) || (entityBeforeMoveOrientation != currentOrientation))
{
MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectMoveInvalid);
m_delayMovementSoundInMillis = MyMinerGame.TotalGamePlayTimeInMilliseconds + 1000;
}
}
}
}
}
}