public override void FromOSD(OpenMetaverse.StructuredData.OSDMap map) { PrincipalID = map["PrincipalID"]; Friend = map["Friend"]; MyFlags = map["MyFlags"]; TheirFlags = map["TheirFlags"]; }
public override void ComputeAndSetLocalInertia(OMV.Vector3 inertiaFactor, float linksetMass) { OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(LinksetRoot.PhysShape.physShapeInfo, linksetMass); LinksetRoot.Inertia = inertia * inertiaFactor; m_physicsScene.PE.SetMassProps(LinksetRoot.PhysBody, linksetMass, LinksetRoot.Inertia); m_physicsScene.PE.UpdateInertiaTensor(LinksetRoot.PhysBody); }
internal AvatarAppearance ToAppearance(OpenMetaverse.UUID owner) { AvatarAppearance app = new AvatarAppearance { Owner = owner, Serial = this.Serial, VisualParams = this.VisualParams }; List<AvatarWearable> wearables = new List<AvatarWearable>(); for (int i = 0; i < AvatarWearable.MAX_WEARABLES && i < this.Wearables.Length; i++) { OpenMetaverse.UUID itemID = new OpenMetaverse.UUID(this.Wearables[i].ItemId); OpenMetaverse.UUID assetID = new OpenMetaverse.UUID(this.Wearables[i].AssetId); wearables.Add(new AvatarWearable(i, itemID, assetID)); } app.SetWearables(wearables); var te = new OpenMetaverse.Primitive.TextureEntry(this.TextureEntry, 0, this.TextureEntry.Length); app.SetTextureEntries(te); app.SetHeight(); return app; }
public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) : base(parent_scene, localID, primName, "BSPrim") { // m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID); _physicsActorType = (int)ActorTypes.Prim; RawPosition = pos; _size = size; Scale = size; // prims are the size the user wants them to be (different for BSCharactes). RawOrientation = rotation; _buoyancy = 0f; RawVelocity = OMV.Vector3.Zero; _rotationalVelocity = OMV.Vector3.Zero; BaseShape = pbs; _isPhysical = pisPhysical; _isVolumeDetect = false; _mass = CalculateMass(); DetailLog("{0},BSPrim.constructor,pbs={1}", LocalID, BSScene.PrimitiveBaseShapeToString(pbs)); // DetailLog("{0},BSPrim.constructor,call", LocalID); // do the actual object creation at taint time PhysScene.TaintedObject(LocalID, "BSPrim.create", delegate() { // Make sure the object is being created with some sanity. ExtremeSanityCheck(true /* inTaintTime */); CreateGeomAndObject(true); CurrentCollisionFlags = PhysScene.PE.GetCollisionFlags(PhysBody); IsInitialized = true; }); }
public AddForceCmd(PhysicsActor actor, OpenMetaverse.Vector3 force, OpenMetaverse.Vector3 forceOffset, ForceType type) { Actor = actor; Force = force; Type = type; ForceOffset = forceOffset; }
public PrimVisualCylinder(OpenMetaverse.Primitive prim) : base(prim) { NumberFaces = 1; FirstOuterFace = 0; LastOuterFace = 0; OuterFaces = new CrossSection[1]; OuterFaces[0] = new CrossSection(); if (prim.PrimData.ProfileHollow != 0) { hollow = true; InnerFaces = new CrossSection[1]; InnerFaces[0] = new CrossSection(); //for (int i = 0; i < 4; i++) //{ // InnerFaces[i] = new CrossSection(); //} } if (prim.PrimData.ProfileBegin != 0 || prim.PrimData.ProfileEnd != 1) { cut = true; CutFaces = new CrossSection[2]; for (int i = 0; i < 2; i++) { CutFaces[i] = new CrossSection(); } } BuildFaces(); }
public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) : base(parent_scene, localID, primName, "BSPrim") { // MainConsole.Instance.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID); _position = pos; _size = size; Scale = size; // prims are the size the user wants them to be (different for BSCharactes). _orientation = rotation; _buoyancy = 0f; RawVelocity = OMV.Vector3.Zero; _rotationalVelocity = OMV.Vector3.Zero; BaseShape = pbs; _isPhysical = pisPhysical; _isVolumeDetect = false; // We keep a handle to the vehicle actor so we can set vehicle parameters later. VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName); PhysicalActors.Add(VehicleActorName, VehicleActor); _mass = CalculateMass(); // DetailLog("{0},BSPrim.constructor,call", LocalID); // do the actual object creation at taint time PhysicsScene.TaintedObject("BSPrim.create", delegate() { // Make sure the object is being created with some sanity. ExtremeSanityCheck(true /* inTaintTime */); CreateGeomAndObject(true); CurrentCollisionFlags = PhysicsScene.PE.GetCollisionFlags(PhysBody); }); }
/// <summary> /// Generates a basic mesh structure from a primitive /// </summary> /// <param name="prim">Primitive to generate the mesh from</param> /// <param name="lod">Level of detail to generate the mesh at</param> /// <returns>The generated mesh or null on failure</returns> public OMVR.SimpleMesh GenerateSimpleMesh(OMV.Primitive prim, OMVR.DetailLevel lod) { PrimMesher.PrimMesh newPrim = GeneratePrimMesh(prim, lod, false); if (newPrim == null) return null; SimpleMesh mesh = new SimpleMesh(); mesh.Path = new Path(); mesh.Prim = prim; mesh.Profile = new Profile(); mesh.Vertices = new List<Vertex>(newPrim.coords.Count); for (int i = 0; i < newPrim.coords.Count; i++) { PrimMesher.Coord c = newPrim.coords[i]; mesh.Vertices.Add(new Vertex { Position = new Vector3(c.X, c.Y, c.Z) }); } mesh.Indices = new List<ushort>(newPrim.faces.Count * 3); for (int i = 0; i < newPrim.faces.Count; i++) { PrimMesher.Face face = newPrim.faces[i]; mesh.Indices.Add((ushort)face.v1); mesh.Indices.Add((ushort)face.v2); mesh.Indices.Add((ushort)face.v3); } return mesh; }
public void StartTrace(TraceSession parent, OpenMetaverse.AgentManager avatarManager) { mGridClient = parent.Client; mAgentManager = avatarManager; mLastUpdate = DateTime.Now; }
public BSLinksetCompoundInfo(int indx, OMV.Vector3 p, OMV.Quaternion r) { Index = indx; OffsetFromRoot = p; OffsetFromCenterOfMass = p; OffsetRot = r; }
public override PhysicsActor AddAvatar(string avName, OpenMetaverse.Vector3 position, OpenMetaverse.Vector3 size, bool isFlying) { BasicActor act = new BasicActor(); act.Position = position; act.Flying = isFlying; _actors.Add(act); return act; }
public static PhysX.Math.Matrix PositionToMatrix(OpenMetaverse.Vector3 position, OpenMetaverse.Quaternion rotation) { MakeFinite(ref position); MakeFinite(ref rotation); return PhysX.Math.Matrix.RotationQuaternion(new PhysX.Math.Quaternion(rotation.X, rotation.Y, rotation.Z, rotation.W)) * PhysX.Math.Matrix.Translation(position.X, position.Y, position.Z); }
public override void FromOSD(OpenMetaverse.StructuredData.OSDMap map) { GlobalPosX = map["GlobalPosX"]; GlobalPosY = map["GlobalPosY"]; LandData = new LandData(); LandData.FromOSD((OSDMap) map["LandData"]); RegionName = map["RegionName"]; RegionType = map["RegionType"]; }
public LLEntityPhysical(AssetContextBase acontext, LLRegionContext rcontext, ulong regionHandle, uint localID, OMV.Primitive prim) : base(rcontext, acontext) { this.Sim = rcontext.Simulator; this.RegionHandle = regionHandle; this.LocalID = localID; this.Prim = prim; this.Name = new EntityNameLL(acontext, m_prim.ID.ToString()); }
public RotationalPrimVisual(OpenMetaverse.Primitive prim) : base(prim) { // TODO: This is temporary, for debugging and entertainment purposes Random rand = new Random((int)prim.LocalID + Environment.TickCount); byte r = (byte)rand.Next(256); byte g = (byte)rand.Next(256); byte b = (byte)rand.Next(256); color = new Color(r, g, b); }
public CreateCharacterCmd(float height, float radius, OpenMetaverse.Vector3 pos, OpenMetaverse.Quaternion rot, bool flying, OpenMetaverse.Vector3 initialVelocity) { _height = height; _radius = radius; _position = pos; _rotation = rot; _flying = flying; _initialVelocity = initialVelocity; }
public override void FromOSD(OpenMetaverse.StructuredData.OSDMap map) { TotalTierDebit = map["TotalTierDebit"]; TotalTierCredits = map["TotalTierCredits"]; ParcelDirectoryFee = map["ParcelDirectoryFee"]; LandFee = map["LandFee"]; ObjectFee = map["ObjectFee"]; GroupFee = map["GroupFee"]; StartingDate = map["StartingDate"]; }
public static void Self_ChatFromSimulator(object sender, OpenMetaverse.ChatEventArgs e) { posCamarero = e.Position; dialogo = new ControlDialogo(e, calcularDistancia()); if (bot.cliente.Self.AgentID != e.OwnerID) { dialogo.responder(); } }
public AssetFetcher(OMV.GridClient grid) { m_client = grid; // m_client.Assets.OnAssetReceived += new OMV.AssetManager.AssetReceivedCallback(Assets_OnAssetReceived); m_requests = new Dictionary<string, TRequest>(); m_outstandingRequests = new List<TRequest>(); m_stats = new StatisticManager("AssetFetcher"); m_totalRequests = m_stats.GetCounter("TotalRequests"); m_duplicateRequests = m_stats.GetCounter("DuplicateRequests"); m_requestsForExisting = m_stats.GetCounter("RequestsForExistingAsset"); }
public static float[] CreateScaleMatrix(OpenMetaverse.Vector3 v) { float[] mat = new float[16]; mat[0] = v.X; mat[5] = v.Y; mat[10] = v.Z; mat[15] = 1; return mat; }
/// <summary> /// Create the animation. The passed animation block is expected /// to contain a defintion of a fixed rotation. If not, bad things will happen. /// </summary> /// <param name="anim">The IAnimation block with the info.</param> /// <param name="id">localID to lookup the prim in the RegionRenderInfo.renderPrimList</param> public AnimatPosition(OMV.Vector3 newPos, float durationSeconds, RegionRenderInfo rri, uint id) : base(AnimatBase.AnimatTypePosition) { m_infoID = id; RenderablePrim rp = rri.renderPrimList[id]; m_origionalPosition = rp.Position; m_targetPosition = newPos; m_durationSeconds = durationSeconds; m_distanceVector = m_targetPosition - m_origionalPosition; m_progress = 0f; }
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical) { Linkset = BSLinkset.Factory(PhysScene, this); PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate() { Linkset.Refresh(this); }); }
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical) { // Default linkset implementation for this prim LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation; Linkset = BSLinkset.Factory(PhysScene, this); Linkset.Refresh(this); }
public BSCharacter( uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 vel, OMV.Vector3 size, bool isFlying) : base(parent_scene, localID, avName, "BSCharacter") { _physicsActorType = (int)ActorTypes.Agent; RawPosition = pos; _flying = isFlying; RawOrientation = OMV.Quaternion.Identity; RawVelocity = vel; _buoyancy = ComputeBuoyancyFromFlying(isFlying); Friction = BSParam.AvatarStandingFriction; Density = BSParam.AvatarDensity; _isPhysical = true; // Old versions of ScenePresence passed only the height. If width and/or depth are zero, // replace with the default values. _size = size; if (_size.X == 0f) _size.X = BSParam.AvatarCapsuleDepth; if (_size.Y == 0f) _size.Y = BSParam.AvatarCapsuleWidth; // The dimensions of the physical capsule are kept in the scale. // Physics creates a unit capsule which is scaled by the physics engine. Scale = ComputeAvatarScale(_size); // set _avatarVolume and _mass based on capsule size, _density and Scale ComputeAvatarVolumeAndMass(); DetailLog( "{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5},pos={6},vel={7}", LocalID, _size, Scale, Density, _avatarVolume, RawMass, pos, vel); // do actual creation in taint time PhysScene.TaintedObject(LocalID, "BSCharacter.create", delegate() { DetailLog("{0},BSCharacter.create,taint", LocalID); // New body and shape into PhysBody and PhysShape PhysScene.Shapes.GetBodyAndShape(true, PhysScene.World, this); // The avatar's movement is controlled by this motor that speeds up and slows down // the avatar seeking to reach the motor's target speed. // This motor runs as a prestep action for the avatar so it will keep the avatar // standing as well as moving. Destruction of the avatar will destroy the pre-step action. m_moveActor = new BSActorAvatarMove(PhysScene, this, AvatarMoveActorName); PhysicalActors.Add(AvatarMoveActorName, m_moveActor); SetPhysicalProperties(); IsInitialized = true; }); return; }
public ChangeChildPrimOffsetCmd(PhysxPrim parent, PhysxPrim child, OpenMetaverse.Vector3 newOffset, OpenMetaverse.Quaternion rotOffset) { Util.ThrowIfNull(parent, "parent"); Util.ThrowIfNull(child, "child"); _parent = parent; _child = child; _newOffset = newOffset; _rotOffset = rotOffset; _affectedPrims = new List<PhysxPrim> { parent, child }; }
public static PhysX.Math.Vector3[] OmvVectorArrayToPhysx(OpenMetaverse.Vector3[] omvArray) { PhysX.Math.Vector3[] physxArray = new PhysX.Math.Vector3[omvArray.Length]; for (int i = 0; i < omvArray.Length; ++i) { OpenMetaverse.Vector3 omvVec = omvArray[i]; physxArray[i] = new PhysX.Math.Vector3(omvVec.X, omvVec.Y, omvVec.Z); } return physxArray; }
public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical, int material, float friction, float restitution, float gravityMultiplier, float density) : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical) { // Default linkset implementation for this prim LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation; Linkset = BSLinkset.Factory(PhysicsScene, this); if (Linkset != null) Linkset.Refresh(this); }
public override bool Excecute(SteelCityAutomaton.Automaton am, OpenMetaverse.GridClient client, bool force) { if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; } UUID target; if (UUID.TryParse(uuid, out target) && amount > 0) { client.Self.GiveAvatarMoney(target, amount,description); result.success = true; } else result.message = "Invalid key or ammount"; return true; }
public string ComputeTextureFilename(string cacheDir, OMV.UUID textureID) { EntityNameLL entName = EntityNameLL.ConvertTextureWorldIDToEntityName(this, textureID); string textureFilename = Path.Combine(CacheDirBase, entName.CacheFilename); // m_log.Log(LogLevel.DTEXTUREDETAIL, "ComputeTextureFilename: " + textureFilename); // make sure the recieving directory is there for the texture MakeParentDirectoriesExist(textureFilename); // m_log.Log(LogLevel.DTEXTUREDETAIL, "ComputerTextureFilename: returning " + textureFilename); return textureFilename; }
internal OpenSim.Framework.ItemPermissionBlock ToItemPermissionBlock(OpenMetaverse.UUID itemId) { return new OpenSim.Framework.ItemPermissionBlock { BasePermissions = this.BasePermissions, CurrentPermissions = this.CurrentPermissions, EveryOnePermissions = this.EveryonePermissions, GroupPermissions = this.GroupPermissions, ItemId = itemId, NextPermissions = this.NextPermissions }; }