本文整理汇总了C#中Body.SetPositionOrientation方法的典型用法代码示例。如果您正苦于以下问题:C# Body.SetPositionOrientation方法的具体用法?C# Body.SetPositionOrientation怎么用?C# Body.SetPositionOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body.SetPositionOrientation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PhysicsNode
public PhysicsNode(SimNode simNode, State State)
: base(simNode.SceneNode)
{
SceneNode = simNode.SceneNode;
SceneNode child = SceneNode;
while (child.NumChildren() > 0) child = child.GetChild(0) as SceneNode;
var hull = new MogreNewt.CollisionPrimitives.ConvexHull(State.PhysicsWorld.World, child, child.Orientation, 0.002f, SceneNode.Name.GetHashCode());
Body = new Body(State.PhysicsWorld.World, hull);
Body.AttachNode(SceneNode);
Body.IsGravityEnabled = true;
Body.SetPositionOrientation(SceneNode._getDerivedPosition(), SceneNode.Orientation); // REALPosition Orient
Body.ForceCallback += State.PhysicsWorld.ForceCallback;
// Body.AngularDamping = new Vector3(1,1,1);
// Body.LinearDamping = 1;
Body.UserData = new PhysicsControlData();
hull.Dispose();
}
示例2: Init
public void Init(State State)
{
this.State = State;
State.PhysicsWorld = this;
World = new MogreNewt.World();
World.SetPlatformArchitecture(MogreNewt.World.PlatformArchitecture.PA_BEST_HARDWARE);
World.SetWorldSize(new Vector3(-500, -500, -500), new Vector3(500, 500, 500));
World.SetSolverModel(MogreNewt.World.SolverModelMode.SM_2_PASS);
World.DebuggerInstance.Init(State.SceneManager);
// using the new "SceneParser" TreeCollision primitive. this will automatically parse an entire tree of
// SceneNodes (parsing all children), and add collision for all meshes in the tree.
var statCol = new MogreNewt.CollisionPrimitives.TreeCollisionSceneParser(World);
statCol.ParseScene(State.SceneManager.RootSceneNode, true, 0); // was floornode
var sceneBody = new Body(World, statCol);
statCol.Dispose();
sceneBody.AttachNode(State.SceneManager.RootSceneNode); // was floornode
sceneBody.SetPositionOrientation(new Vector3(0.0f, 0.0f, 0.0f), Quaternion.IDENTITY);
var ent = State.SceneManager.CreateEntity("cylinder_body", "mocksub.mesh");
var simNode = new SimNode(State.SceneManager.RootSceneNode, ent);
// rigid body.
var phyNode = new PhysicsNode(simNode, State);
phyNode.Body.SetPositionOrientation(new Vector3(0, 10, 0), Quaternion.IDENTITY);
phyNode.Body.SetMassMatrix(125, Vector3.ZERO);
var physicsNode = new PhysicsNode(State.SubNode, State);
physicsNode.Body.SetMassMatrix(125, Vector3.ZERO);
// TODO: FIX THIS State.SubNode = physicsNode;
// initial position
State.Root.FrameStarted += NewtonUpdate;
}