public void SetSceneObject(MSceneObject so) { Target = so; _physics = null; if (Target != null) { _physics = (MPhysicsObject)Target.FindModuleByType(EType.PhysicsObject); } }
//private MSceneObject parent; public MTeleportOneShot(MSceneObject inparent, Vector3d inTargetPos, Quaterniond inTargetRot) : base(EType.Teleport, "TeleportAnim") { Parent = inparent; StartPosition = inparent.transform.Position; StartRotation = inparent.transform.Rotation; TargetPosition = inTargetPos; TargetRotation = inTargetRot; MPhysicsObject po = (MPhysicsObject)Parent.FindModuleByType(EType.PhysicsObject); if (po != null) { po.SetActive(false); } Start = 0; }
void CloseDoor() { if (DoorIsOpen == false) { return; } DoorIsOpen = false; MMoveSync ms = (MMoveSync)msoParent.FindModuleByType(EType.MoveSync); if (ms != null) { ms.Stop(); msoParent.Remove(ms); } ms = new MMoveSync(msoParent, msoParent.transform.Position, OriginalOrientation); ms.Speed = 0.5; msoParent.Add(ms); //Globals.Network.PositionRequest(msoParent.InstanceID, msoParent.transform.Position, OriginalOrientation); }
/** * Creates a copy of an existing object from the TemplateRoot * */ public static MSceneObject Spawn(MServerObject mso, Vector3d Pos, Quaterniond Rot) { MSceneObject m = (MSceneObject)MScene.TemplateRoot.FindModuleByInstanceID(mso.TemplateID); if (m == null) { Console.WriteLine("TEMPLATE NOT LOADED INTO MScene.TemplateRoot:" + mso.TemplateID); return(null); } MSceneObject t = null; MObject TargetRoot = MScene.ModelRoot; if (m.IsTransparent) { TargetRoot = MScene.Priority2; } else { TargetRoot = MScene.Priority1; } if (m.Type == MObject.EType.PrimitiveCube) { t = CreateCube(TargetRoot, mso.Name, Pos); } if (m.Type == MObject.EType.PrimitiveSphere) { t = CreateSphere(TargetRoot, 2, mso.Name, Pos); } if (m.Type == MObject.EType.Model) { t = SpawnModel(TargetRoot, mso.TemplateID, mso.OwnerID, mso.Name, Pos); } if (m.Type == MObject.EType.AnimatedModel) { t = SpawnAnimatedModel(TargetRoot, mso.TemplateID, mso.OwnerID, mso.Name, Pos); //MAnimatedModel man = (MAnimatedModel)m; //man.BoneOffset = MassiveTools.VectorFromArray(t.BoneOffset); } if (m.Type == MObject.EType.InstanceMesh) { t = SpawnInstanced(TargetRoot, mso.TemplateID, mso.OwnerID, mso.Name, Pos); } t.transform.Position = Pos; t.transform.Rotation = Rot; m.CopyTo(t); t.OwnerID = mso.OwnerID; t.transform.Position = Pos; t.transform.Rotation = Rot; t.Tag = mso.Tag; MClickHandler ch = (MClickHandler)m.FindModuleByType(MObject.EType.ClickHandler); if (ch != null) { MClickHandler ch2 = new MClickHandler(); ch2.Clicked = ch.Clicked; ch2.RightClicked = ch.RightClicked; ch2.DoubleClicked = ch.DoubleClicked; t.Add(ch2); } return(t); }
public override void Setup() { MSceneObject so = (MSceneObject)Parent; _physics = (MPhysicsObject)so.FindModuleByType(EType.PhysicsObject); }
public MDoor(MSceneObject inParent) : base(EType.Door, "Door") { OriginalOrientation = inParent.transform.Rotation; msoParent = inParent; msoParentPhysics = (MPhysicsObject)msoParent.FindModuleByType(EType.PhysicsObject); }