本文整理汇总了C#中Body.SetMassMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# Body.SetMassMatrix方法的具体用法?C# Body.SetMassMatrix怎么用?C# Body.SetMassMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body.SetMassMatrix方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WayPoint
public WayPoint()
{
_Orientation = Quaternion.IDENTITY;
_DisplayNameOffset = new Vector3(0, 0.2f, 0);
Entity = Engine.Singleton.SceneManager.CreateEntity("Spawn.mesh");
Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
Node.AttachObject(Entity);
ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
Node,
Quaternion.IDENTITY,
0.1f,
Engine.Singleton.GetUniqueBodyId());
Vector3 inertia, offset;
collision.CalculateInertialMatrix(out inertia, out offset);
Inertia = inertia;
Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
Body.AttachNode(Node);
Body.SetMassMatrix(0, inertia * 0);
Body.ForceCallback += BodyForceCallback;
Body.UserData = this;
Body.MaterialGroupID = Engine.Singleton.MaterialManager.WaypointMaterialID;
//Body.MaterialGroupID = Engine.Singleton.MaterialManager.CharacterMaterialID;
collision.Dispose();
}
示例2: Character
public Character(CharacterProfile profile)
{
m_Profile = profile.Clone();
m_Orientation = Quaternion.IDENTITY;
m_Entity = Core.Singleton.m_SceneManager.CreateEntity(m_Profile.m_MeshName);
m_Node = Core.Singleton.m_SceneManager.RootSceneNode.CreateChildSceneNode();
m_Node.AttachObject(m_Entity);
Vector3 scaledSize = m_Entity.BoundingBox.HalfSize * m_Profile.m_BodyScaleFactor;
ConvexCollision collision = new MogreNewt.CollisionPrimitives.Capsule(
Core.Singleton.m_NewtonWorld,
System.Math.Min(scaledSize.x, scaledSize.z),
scaledSize.y * 2,
Vector3.UNIT_X.GetRotationTo(Vector3.UNIT_Y),
Core.Singleton.GetUniqueBodyId());
Vector3 inertia, offset;
collision.CalculateInertialMatrix(out inertia, out offset);
inertia *= m_Profile.m_BodyMass;
m_Body = new Body(Core.Singleton.m_NewtonWorld, collision, true);
m_Body.AttachNode(m_Node);
m_Body.SetMassMatrix(m_Profile.m_BodyMass, inertia);
m_Body.AutoSleep = false;
m_Body.Transformed += BodyTransformCallback;
m_Body.ForceCallback += BodyForceCallback;
Joint upVector = new MogreNewt.BasicJoints.UpVector(
Core.Singleton.m_NewtonWorld, m_Body, Vector3.UNIT_Y);
collision.Dispose();
}
示例3: Enemy
public Enemy(CharacterProfile profile, bool czyPojemnik, float zasiegWzr, float zasiegOgl)
{
Profile = profile.Clone();
_Orientation = Quaternion.IDENTITY;
Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
Node.AttachObject(Entity);
Vector3 scaledSize = Entity.BoundingBox.HalfSize * Profile.BodyScaleFactor;
ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
Node,
Quaternion.IDENTITY,
0.1f,
Engine.Singleton.GetUniqueBodyId());
Vector3 inertia, offset;
collision.CalculateInertialMatrix(out inertia, out offset);
inertia *= Profile.BodyMass;
Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
Body.AttachNode(Node);
Body.SetMassMatrix(Profile.BodyMass, inertia);
Body.AutoSleep = false;
Body.Transformed += BodyTransformCallback;
Body.ForceCallback += BodyForceCallback;
Body.UserData = this;
Body.MaterialGroupID = Engine.Singleton.MaterialManager.EnemyMaterialID;
Joint upVector = new MogreNewt.BasicJoints.UpVector(
Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y);
collision.Dispose();
isContainer = czyPojemnik;
isSeen = false;
isReachable = false;
_ZasiegWzroku = zasiegWzr;
_ZasiegOgolny = zasiegOgl;
_Statistics = Profile.Statistics.statistics_Clone();
State = StateTypes.IDLE;
//DROPPRIZE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
if (Profile.DropPrizeID == "")
Profile.DropPrizeID = "pPusty";
DropPrize = PrizeManager.P[Profile.DropPrizeID].prize_Clone();
List<DescribedProfile> lista_tym = new List<DescribedProfile>();
List<DescribedProfile> lista_tym2 = new List<DescribedProfile>(DropPrize.ItemsList);
if (DropPrize.ItemsList.Count > 2)
{
for (int i = 0; i < 2; i++)
{
int Los = Engine.Singleton.Random.Next(lista_tym2.Count);
lista_tym.Add(lista_tym2[Los]);
lista_tym2.RemoveAt(Los);
DropPrize.ItemsList = new List<DescribedProfile>(lista_tym);
}
}
else
DropPrize.ItemsList = new List<DescribedProfile>(DropPrize.ItemsList);
DropPrize.AmountGold = Engine.Singleton.Random.Next(DropPrize.AmountGold / 2, DropPrize.AmountGold + 1);
DropExp = DropPrize.AmountExp;
//PO DROPPRIZIE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
walkAnim = Entity.GetAnimationState("WALK");
idleAnim = Entity.GetAnimationState("IDLE");
attackAnim = Entity.GetAnimationState("ATTACK");
deadAnim = Entity.GetAnimationState("DEAD");
//Animation("IdleLegs").Enabled = true;
//Animation("IdleLegs").Loop = true;
FriendlyType = Profile.FriendlyType;
ProfName = Profile.ProfileName;
}
示例4: RecalculateCollision
public void RecalculateCollision()
{
Vector3 pos = Position;
Quaternion orient = Orientation;
Node.DetachAllObjects();
Engine.Singleton.SceneManager.DestroySceneNode(Node);
Engine.Singleton.SceneManager.DestroyEntity(Entity);
Body.Dispose();
Body = null;
Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
Node.AttachObject(Entity);
ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
Node,
Quaternion.IDENTITY,
0.1f,
Engine.Singleton.GetUniqueBodyId());
Vector3 inertia, offset;
collision.CalculateInertialMatrix(out inertia, out offset);
inertia *= Profile.BodyMass;
Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
Body.AttachNode(Node);
Body.SetMassMatrix(Profile.BodyMass, inertia);
Body.AutoSleep = false;
Body.Transformed += BodyTransformCallback;
Body.ForceCallback += BodyForceCallback;
Orientation = orient;
Position = pos;
Body.UserData = this;
Body.MaterialGroupID = Engine.Singleton.MaterialManager.EnemyMaterialID;
Joint upVector = new MogreNewt.BasicJoints.UpVector(
Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y);
collision.Dispose();
}
示例5: EndShapeBuild
public void EndShapeBuild()
{
Collision collision = new MogreNewt.CollisionPrimitives.CompoundCollision(
Engine.Singleton.NewtonWorld,
CompoundParts.ToArray(),
Engine.Singleton.GetUniqueBodyId());
Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
Body.SetMassMatrix(0, Vector3.ZERO);
Body.UserData = this;
Body.MaterialGroupID = Engine.Singleton.MaterialManager.TriggerVolumeMaterialID;
// Usuwamy z pamięci już użyte części geometrii
foreach (ConvexCollision c in CompoundParts)
c.Dispose();
CompoundParts = null;
}
示例6: EnemyDecTree
//public List<GameObject> Contacts;
//public Described PickingTarget;
//public List<DescribedProfile> Inventory;
//ItemSword _Sword;
//Entity SwordEntity;
//public CharacterAnimBlender AnimBlender;
//public bool TalkPerm;
//public bool InventoryPerm;
//public bool PickItemOrder;
//public bool MoveOrder;
//public bool MoveOrderBack;
//public bool GetSwordOrder;
//public bool HideSwordOrder;
//bool _RunOrder;
/*public bool RunOrder
{
get
{
return _RunOrder;
}
set
{
if (_RunOrder == true && value == false)
{
_RunOrder = false;
Profile.WalkSpeed -= 2.0f;
}
if (_RunOrder == false && value == true)
{
_RunOrder = true;
Profile.WalkSpeed += 2.0f;
}
}
}
public float TurnDelta;
public bool FollowPathOrder;
public List<Vector3> WalkPath;
public static DecTree.Enemies.e_Node Tree = new EnemyDecTree();
//////////////////////////////////////////////
// Moje zmienne:
//////////////////////////////////////////////
Container Container;
public bool isContainer;
bool isSeen;
bool isReachable;
float ZasiegWzroku;
float ZasiegOgolny;
Prize DropPrize;
public Statistics Statistics;*/
public Enemy(CharacterProfile profile)
{
Profile = profile.Clone();
_Orientation = Quaternion.IDENTITY;
Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
Node.AttachObject(Entity);
// Vector3 scaledSize = Entity.BoundingBox.HalfSize * Profile.BodyScaleFactor;
ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
Node,
Quaternion.IDENTITY,
0.1f,
Engine.Singleton.GetUniqueBodyId());
Vector3 inertia, offset;
collision.CalculateInertialMatrix(out inertia, out offset);
Inertia = inertia;
Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
Body.AttachNode(Node);
Body.SetMassMatrix(Profile.BodyMass, inertia * Profile.BodyMass);
//Body.AutoSleep = false;
//Body.Transformed += BodyTransformCallback;
Body.ForceCallback += BodyForceCallback;
Body.UserData = this;
Body.MaterialGroupID = Engine.Singleton.MaterialManager.CharacterMaterialID;
//Joint upVector = new MogreNewt.BasicJoints.UpVector(
// Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y);
collision.Dispose();
}