本文整理汇总了C#中PhysicsScene类的典型用法代码示例。如果您正苦于以下问题:C# PhysicsScene类的具体用法?C# PhysicsScene怎么用?C# PhysicsScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhysicsScene类属于命名空间,在下文中一共展示了PhysicsScene类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestScene
public TestScene(
RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene,
SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService,
IConfigSource config, string simulatorVersion)
: base(regInfo, authen, physicsScene, sceneGridService, simDataService, estateDataService,
config, simulatorVersion)
{
}
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:8,代码来源:TestScene.cs
示例2: Create
public Simulation Create(PhysicsProcessor sceneProcessor, PhysicsEngineFlags flags = PhysicsEngineFlags.None)
{
var scene = new PhysicsScene { Processor = sceneProcessor, Simulation = new Simulation(flags) };
lock (this)
{
scenes.Add(scene);
}
return scene.Simulation;
}
开发者ID:hsabaleuski,项目名称:paradox,代码行数:9,代码来源:Bullet2PhysicsSystem.cs
示例3: Initialize
public void Initialize()
{
IConfigSource openSimINI = new IniConfigSource();
IConfig startupConfig = openSimINI.AddConfig("Startup");
startupConfig.Set("physics", "OpenDynamicsEngine");
startupConfig.Set("DecodedSculptMapPath", "j2kDecodeCache");
Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
//PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
// "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);
RegionInfo info = new RegionInfo();
info.RegionName = "ODETestRegion";
info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info);
//IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer();
//INonSharedRegionModule mod = mesher as INonSharedRegionModule;
//mod.Initialise(openSimINI);
//mod.AddRegion(scene);
//mod.RegionLoaded(scene);
pScene = new OdeScene();
Console.WriteLine("HERE " + (pScene == null ? "Null" : "Not null"));
INonSharedRegionModule mod = (pScene as INonSharedRegionModule);
Console.WriteLine("HERE " + (mod == null ? "Null" : "Not null"));
mod.Initialise(openSimINI);
mod.AddRegion(scene);
mod.RegionLoaded(scene);
// Loading ODEPlugin
//cbt = new OdePlugin();
// Getting Physics Scene
//ps = cbt.GetScene("test");
// Initializing Physics Scene.
//ps.Initialise(imp.GetMesher(TopConfig), null, Vector3.Zero);
float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize];
for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++)
{
_heightmap[i] = 21f;
}
pScene.SetTerrain(_heightmap);
}
开发者ID:Gitlab11,项目名称:opensim,代码行数:43,代码来源:ODETestClass.cs
示例4: PhysicalSpriteUV
public PhysicalSpriteUV(TextureInfo textureInfo, PhysicsScene physicsScene, bool circle = false)
: base(textureInfo)
{
// Texture Setup
Quad.S = TextureInfo.TextureSizef;
Pivot = new Vector2(TextureInfo.Texture.Width / 2f, TextureInfo.Texture.Height / 2f );
// Physics Setup (get the indicies we will be using
PhysicsScene = physicsScene;
ShapeIndex = PhysicsScene.NumShape;
BodyIndex = PhysicsScene.NumBody;
JointIndex = -1;
// Create shapes (will want to let the programmer pass in things like friction and rotation at some point, AND SPECIFY CIRCLE OR SQUARE SHAPE)
PhysicsShape shape;
if(!circle)
{
shape = new PhysicsShape(new Vector2(textureInfo.Texture.Width/2, textureInfo.Texture.Height/2));
}
else
{
shape = new PhysicsShape(textureInfo.Texture.Width/2);
}
// Why 100?
PhysicsBody body = new PhysicsBody(shape, 100);
body.ShapeIndex = (uint)ShapeIndex;
PhysicsScene.sceneShapes[ShapeIndex] = shape;
PhysicsScene.sceneBodies[BodyIndex] = body;
//PhysicsScene.sceneBodies[BodyIndex].Rotation = 0.1f;
//PhysicsScene.sceneBodies[BodyIndex].AirFriction = 0.01f;
PhysicsScene.NumShape++;
PhysicsScene.NumBody++;
}
开发者ID:edibletoaster,项目名称:PSM-Game,代码行数:36,代码来源:PhysicalSpriteUV.cs
示例5: Scene
public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene,
SceneCommunicationService sceneGridService,
ISimulationDataService simDataService, IEstateDataService estateDataService,
IConfigSource config, string simulatorVersion)
: this(regInfo, physicsScene)
{
m_config = config;
MinFrameTime = 0.089f;
MinMaintenanceTime = 1;
SeeIntoRegion = true;
Random random = new Random();
m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4);
m_authenticateHandler = authen;
m_sceneGridService = sceneGridService;
m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService;
m_regionHandle = RegionInfo.RegionHandle;
m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
m_asyncSceneObjectDeleter.Enabled = true;
m_asyncInventorySender = new AsyncInventorySender(this);
#region Region Settings
// Load region settings
// LoadRegionSettings creates new region settings in persistence if they don't already exist for this region.
// However, in this case, the default textures are not set in memory properly, so we need to do it here and
// resave.
// FIXME: It shouldn't be up to the database plugins to create this data - we should do it when a new
// region is set up and avoid these gyrations.
RegionSettings rs = simDataService.LoadRegionSettings(RegionInfo.RegionID);
m_extraSettings = simDataService.GetExtra(RegionInfo.RegionID);
bool updatedTerrainTextures = false;
if (rs.TerrainTexture1 == UUID.Zero)
{
rs.TerrainTexture1 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_1;
updatedTerrainTextures = true;
}
if (rs.TerrainTexture2 == UUID.Zero)
{
rs.TerrainTexture2 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_2;
updatedTerrainTextures = true;
}
if (rs.TerrainTexture3 == UUID.Zero)
{
rs.TerrainTexture3 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_3;
updatedTerrainTextures = true;
}
if (rs.TerrainTexture4 == UUID.Zero)
{
rs.TerrainTexture4 = RegionSettings.DEFAULT_TERRAIN_TEXTURE_4;
updatedTerrainTextures = true;
}
if (updatedTerrainTextures)
rs.Save();
RegionInfo.RegionSettings = rs;
if (estateDataService != null)
RegionInfo.EstateSettings = estateDataService.LoadEstateSettings(RegionInfo.RegionID, false);
#endregion Region Settings
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
RegisterDefaultSceneEvents();
// XXX: Don't set the public property since we don't want to activate here. This needs to be handled
// better in the future.
m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts;
PhysicsEnabled = !RegionInfo.RegionSettings.DisablePhysics;
m_simulatorVersion = simulatorVersion + " (" + Util.GetRuntimeInformation() + ")";
#region Region Config
// Region config overrides global config
//
if (m_config.Configs["Startup"] != null)
{
IConfig startupConfig = m_config.Configs["Startup"];
StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance", m_defaultDrawDistance);
UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
if (!UseBackup)
//.........这里部分代码省略.........
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:101,代码来源:Scene.cs
示例6: UnCombine
// Unhook all the combining that I know about.
public void UnCombine(PhysicsScene pScene)
{
// Just like ODE, for the moment a NOP
DetailLog("{0},BSTerrainManager.UnCombine", BSScene.DetailLogZero);
}
开发者ID:CCIR,项目名称:opensim,代码行数:6,代码来源:BSTerrainManager.cs
示例7: MainScene_PostStep
void MainScene_PostStep( PhysicsScene scene )
{
if( mainBody != null && !mainBody.Sleeping )
UpdateRotation( false );
}
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:5,代码来源:Character.cs
示例8: SceneHelpers
public SceneHelpers(CoreAssetCache cache)
{
SceneManager = new SceneManager();
m_assetService = StartAssetService(cache);
m_authenticationService = StartAuthenticationService();
m_inventoryService = StartInventoryService();
m_gridService = StartGridService();
m_userAccountService = StartUserAccountService();
m_presenceService = StartPresenceService();
m_inventoryService.PostInitialise();
m_assetService.PostInitialise();
m_userAccountService.PostInitialise();
m_presenceService.PostInitialise();
m_cache = cache;
m_physicsScene = StartPhysicsScene();
SimDataService
= OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:23,代码来源:SceneHelpers.cs
示例9: Combine
// This routine is called two ways:
// One with 'offset' and 'pScene' zero and null but 'extents' giving the maximum
// extent of the combined regions. This is to inform the parent of the size
// of the combined regions.
// and one with 'offset' as the offset of the child region to the base region,
// 'pScene' pointing to the parent and 'extents' of zero. This informs the
// child of its relative base and new parent.
public void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
{
m_worldOffset = offset;
m_worldMax = extents;
MegaRegionParentPhysicsScene = pScene;
if (pScene != null)
{
// We are a child.
// We want m_worldMax to be the highest coordinate of our piece of terrain.
m_worldMax = offset + DefaultRegionSize;
}
DetailLog("{0},BSTerrainManager.Combine,offset={1},extents={2},wOffset={3},wMax={4}",
BSScene.DetailLogZero, offset, extents, m_worldOffset, m_worldMax);
}
开发者ID:justasabc,项目名称:opensim75grid,代码行数:21,代码来源:BSTerrainManager.cs
示例10: BSTerrainManager
public BSTerrainManager(BSScene physicsScene)
{
PhysicsScene = physicsScene;
m_terrains = new Dictionary<Vector3,BSTerrainPhys>();
// Assume one region of default size
m_worldOffset = Vector3.Zero;
m_worldMax = new Vector3(DefaultRegionSize);
MegaRegionParentPhysicsScene = null;
}
开发者ID:justasabc,项目名称:opensim75grid,代码行数:10,代码来源:BSTerrainManager.cs
示例11: AddPhysicsStats
public virtual void AddPhysicsStats(UUID RegionID, PhysicsScene scene)
{
lock (m_currentPhysicsStats)
{
PhysicsStats stats;
if (!m_currentPhysicsStats.TryGetValue(RegionID, out stats))
{
stats = new PhysicsStats();
stats.StatAvatarUpdatePosAndVelocity = scene.StatAvatarUpdatePosAndVelocity;
stats.StatCollisionOptimizedTime = scene.StatCollisionOptimizedTime;
stats.StatPhysicsMoveTime = scene.StatPhysicsMoveTime;
stats.StatPhysicsTaintTime = scene.StatPhysicsTaintTime;
stats.StatPrimUpdatePosAndVelocity = scene.StatPrimUpdatePosAndVelocity;
stats.StatSendCollisionsTime = scene.StatSendCollisionsTime;
stats.StatUnlockedArea = scene.StatUnlockedArea;
stats.StatFindContactsTime = scene.StatFindContactsTime;
stats.StatContactLoopTime = scene.StatContactLoopTime;
stats.StatCollisionAccountingTime = scene.StatCollisionAccountingTime;
}
else
{
stats.StatAvatarUpdatePosAndVelocity += scene.StatAvatarUpdatePosAndVelocity;
stats.StatCollisionOptimizedTime += scene.StatCollisionOptimizedTime;
stats.StatPhysicsMoveTime += scene.StatPhysicsMoveTime;
stats.StatPhysicsTaintTime += scene.StatPhysicsTaintTime;
stats.StatPrimUpdatePosAndVelocity += scene.StatPrimUpdatePosAndVelocity;
stats.StatSendCollisionsTime += scene.StatSendCollisionsTime;
stats.StatUnlockedArea += scene.StatUnlockedArea;
stats.StatFindContactsTime += scene.StatFindContactsTime;
stats.StatContactLoopTime += scene.StatContactLoopTime;
stats.StatCollisionAccountingTime += scene.StatCollisionAccountingTime;
}
m_currentPhysicsStats[RegionID] = stats;
PhysicsStats ProfilerStats = new PhysicsStats();
ProfilerStats.StatAvatarUpdatePosAndVelocity = scene.StatAvatarUpdatePosAndVelocity;
ProfilerStats.StatCollisionOptimizedTime = scene.StatCollisionOptimizedTime;
ProfilerStats.StatPhysicsMoveTime = scene.StatPhysicsMoveTime;
ProfilerStats.StatPhysicsTaintTime = scene.StatPhysicsTaintTime;
ProfilerStats.StatPrimUpdatePosAndVelocity = scene.StatPrimUpdatePosAndVelocity;
ProfilerStats.StatSendCollisionsTime = scene.StatSendCollisionsTime;
ProfilerStats.StatUnlockedArea = scene.StatUnlockedArea;
ProfilerStats.StatFindContactsTime = scene.StatFindContactsTime;
ProfilerStats.StatContactLoopTime = scene.StatContactLoopTime;
ProfilerStats.StatCollisionAccountingTime = scene.StatCollisionAccountingTime;
//Add the stats to the profiler
Profiler p = ProfilerManager.GetProfiler();
p.AddStat("CurrentStatAvatarUpdatePosAndVelocity " + RegionID,
ProfilerStats.StatAvatarUpdatePosAndVelocity);
p.AddStat("CurrentStatCollisionOptimizedTime " + RegionID,
ProfilerStats.StatCollisionOptimizedTime);
p.AddStat("CurrentStatPhysicsMoveTime " + RegionID,
ProfilerStats.StatPhysicsMoveTime);
p.AddStat("CurrentStatPhysicsTaintTime " + RegionID,
ProfilerStats.StatPhysicsTaintTime);
p.AddStat("CurrentStatPrimUpdatePosAndVelocity " + RegionID,
ProfilerStats.StatPrimUpdatePosAndVelocity);
p.AddStat("CurrentStatSendCollisionsTime " + RegionID,
ProfilerStats.StatSendCollisionsTime);
p.AddStat("CurrentStatUnlockedArea " + RegionID,
ProfilerStats.StatUnlockedArea);
p.AddStat("CurrentStatFindContactsTime " + RegionID,
ProfilerStats.StatFindContactsTime);
p.AddStat("CurrentStatContactLoopTime " + RegionID,
ProfilerStats.StatContactLoopTime);
p.AddStat("CurrentStatCollisionAccountingTime " + RegionID,
ProfilerStats.StatCollisionAccountingTime);
}
}
开发者ID:mugginsm,项目名称:Aurora-Sim,代码行数:71,代码来源:PhysicsMonitor.cs
示例12: BSTerrainManager
public BSTerrainManager(BSScene physicsScene)
{
PhysicsScene = physicsScene;
m_heightMaps = new Dictionary<Vector2,BulletHeightMapInfo>();
m_terrainModified = false;
// Assume one region of default size
m_worldOffset = Vector3.Zero;
m_worldMax = new Vector3(DefaultRegionSize);
MegaRegionParentPhysicsScene = null;
}
开发者ID:CCIR,项目名称:opensim,代码行数:11,代码来源:BSTerrainManager.cs
示例13: Combine
public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
{
m_worldOffset = offset;
WorldExtents = new Vector2(extents.X, extents.Y);
m_parentScene = pScene;
}
开发者ID:shangcheng,项目名称:Aurora,代码行数:7,代码来源:OdePlugin.cs
示例14: UnCombine
public override void UnCombine(PhysicsScene pScene)
{
IntPtr localGround = IntPtr.Zero;
// float[] localHeightfield;
bool proceed = false;
List<IntPtr> geomDestroyList = new List<IntPtr>();
lock (OdeLock)
{
if (RegionTerrain.TryGetValue(Vector3.Zero, out localGround))
{
foreach (IntPtr geom in TerrainHeightFieldHeights.Keys)
{
if (geom == localGround)
{
// localHeightfield = TerrainHeightFieldHeights[geom];
proceed = true;
}
else
{
geomDestroyList.Add(geom);
}
}
if (proceed)
{
m_worldOffset = Vector3.Zero;
WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
m_parentScene = null;
foreach (IntPtr g in geomDestroyList)
{
// removingHeightField needs to be done or the garbage collector will
// collect the terrain data before we tell ODE to destroy it causing
// memory corruption
if (TerrainHeightFieldHeights.ContainsKey(g))
{
// float[] removingHeightField = TerrainHeightFieldHeights[g];
TerrainHeightFieldHeights.Remove(g);
if (RegionTerrain.ContainsKey(g))
{
RegionTerrain.Remove(g);
}
d.GeomDestroy(g);
//removingHeightField = new float[0];
}
}
}
else
{
m_log.Warn("[PHYSICS]: Couldn't proceed with UnCombine. Region has inconsistant data.");
}
}
}
}
开发者ID:shangcheng,项目名称:Aurora,代码行数:59,代码来源:OdePlugin.cs
示例15: Combine
public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) {}
开发者ID:Gitlab11,项目名称:opensim,代码行数:1,代码来源:PhysicsScene.cs
示例16: Combine
// This call says I am a child to region zero in a mega-region. 'pScene' is that
// of region zero, 'offset' is my offset from regions zero's origin, and
// 'extents' is the largest XY that is handled in my region.
public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
{
TerrainManager.Combine(pScene, offset, extents);
}
开发者ID:Michelle-Argus,项目名称:opensim,代码行数:7,代码来源:BSScene.cs
示例17: OnDestroyScene
protected override void OnDestroyScene( PhysicsScene scene )
{
PhysXPhysicsScene scene2 = (PhysXPhysicsScene)scene;
scene2.Destroy();
}
开发者ID:whztt07,项目名称:SDK,代码行数:5,代码来源:PhysXPhysicsWorld.cs
示例18: MainPhysicsScene_PostStep
void MainPhysicsScene_PostStep( PhysicsScene scene )
{
if( resetYCoordinateForDynamicBodies )
DoResetYCoordinateForDynamicBodies();
}
开发者ID:whztt07,项目名称:SDK,代码行数:5,代码来源:GameMap.cs
示例19: UnCombine
public virtual void UnCombine(PhysicsScene pScene) {}
开发者ID:Gitlab11,项目名称:opensim,代码行数:1,代码来源:PhysicsScene.cs
示例20: InitializePhysics
public void InitializePhysics()
{
engine = new PhysicsEngine("MetaliPhysics");
scene = engine.Factory.PhysicsSceneManager.Create("Scene");
scene.TimeOfSimulation = 0.016f;
}
开发者ID:NinjaSteph,项目名称:SureShot,代码行数:6,代码来源:MataliPhysics.cs
注:本文中的PhysicsScene类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论