本文整理汇总了C#中OpenMetaverse.Quaternion类的典型用法代码示例。如果您正苦于以下问题:C# Quaternion类的具体用法?C# Quaternion怎么用?C# Quaternion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Quaternion类属于OpenMetaverse命名空间,在下文中一共展示了Quaternion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Clear
public override void Clear()
{
Index = 0;
OffsetFromRoot = OMV.Vector3.Zero;
OffsetFromCenterOfMass = OMV.Vector3.Zero;
OffsetRot = OMV.Quaternion.Identity;
}
示例2: BSLinksetCompoundInfo
public BSLinksetCompoundInfo(int indx, OMV.Vector3 p, OMV.Quaternion r)
{
Index = indx;
OffsetFromRoot = p;
OffsetFromCenterOfMass = p;
OffsetRot = r;
}
示例3: EntityCamera
public EntityCamera(RegionContextBase rcontext, AssetContextBase acontext)
: base(rcontext, acontext)
{
m_yawFixed = true;
m_globalPosition = new OMV.Vector3d(40f, 40f, 30f);
m_heading = new OMV.Quaternion(0f, 1f, 0f);
}
示例4: CameraControl
public CameraControl()
{
m_heading = new OMV.Quaternion(OMV.Vector3.UnitY, 0f);
m_globalPosition = new OMV.Vector3d(0d, 20d, 30d); // World coordinates (Z up)
m_zoom = 1.0f;
m_far = 300.0f;
m_yawFixed = true;
}
示例5: BSCharacter
public BSCharacter(uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
bool isFlying)
: base(parent_scene, localID, avName, "BSCharacter")
{
_physicsActorType = (int)ActorTypes.Agent;
_isPhysical = true;
_position = pos;
_flying = isFlying;
_orientation = OMV.Quaternion.Identity;
RawVelocity = OMV.Vector3.Zero;
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
Friction = BSParam.AvatarStandingFriction;
Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor;
// 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();
// 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(PhysicsScene, this, AvatarMoveActorName);
PhysicalActors.Add(AvatarMoveActorName, m_moveActor);
DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
LocalID, _size, Scale, Density, _avatarVolume, RawMass);
// do actual creation in taint time
PhysicsScene.TaintedObject(LocalID, "BSCharacter.create", delegate()
{
DetailLog("{0},BSCharacter.create,taint", LocalID);
// New body and shape into PhysBody and PhysShape
PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this);
SetPhysicalProperties();
SubscribeEvents(1000);
});
return;
}
示例6: DetectParams
public DetectParams()
{
Key = UUID.Zero;
OffsetPos = new OpenMetaverse.Vector3();
LinkNum = 0;
Group = UUID.Zero;
Name = String.Empty;
Owner = UUID.Zero;
Position = new OpenMetaverse.Vector3();
Rotation = new OpenMetaverse.Quaternion();
Type = 0;
Velocity = new OpenMetaverse.Vector3();
initializeSurfaceTouch();
}
示例7: BSCharacter
public BSCharacter(uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, bool isFlying)
{
base.BaseInitialize(parent_scene, localID, avName, "BSCharacter");
_physicsActorType = (int)ActorTypes.Agent;
_position = pos;
_size = size;
_flying = isFlying;
_orientation = OMV.Quaternion.Identity;
_velocity = OMV.Vector3.Zero;
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
// The dimensions of the avatar capsule are kept in the scale.
// Physics creates a unit capsule which is scaled by the physics engine.
ComputeAvatarScale(_size);
_avatarDensity = PhysicsScene.Params.avatarDensity;
// set _avatarVolume and _mass based on capsule size, _density and _scale
ComputeAvatarVolumeAndMass();
ShapeData shapeData = new ShapeData();
shapeData.ID = LocalID;
shapeData.Type = ShapeData.PhysicsShapeType.SHAPE_AVATAR;
shapeData.Position = _position;
shapeData.Rotation = _orientation;
shapeData.Velocity = _velocity;
shapeData.Scale = _scale;
shapeData.Mass = _mass;
shapeData.Buoyancy = _buoyancy;
shapeData.Static = ShapeData.numericFalse;
shapeData.Friction = PhysicsScene.Params.avatarFriction;
shapeData.Restitution = PhysicsScene.Params.avatarRestitution;
// do actual create at taint time
PhysicsScene.TaintedObject("BSCharacter.create", delegate()
{
DetailLog("{0},BSCharacter.create,taint", LocalID);
BulletSimAPI.CreateObject(PhysicsScene.WorldID, shapeData);
// Set the buoyancy for flying. This will be refactored when all the settings happen in C#.
// If not set at creation, the avatar will stop flying when created after crossing a region boundry.
BulletSimAPI.SetObjectBuoyancy(PhysicsScene.WorldID, LocalID, _buoyancy);
BSBody = new BulletBody(LocalID, BulletSimAPI.GetBodyHandle2(PhysicsScene.World.ptr, LocalID));
// This works here because CreateObject has already put the character into the physical world.
BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr,
(uint)CollisionFilterGroups.AvatarFilter, (uint)CollisionFilterGroups.AvatarMask);
});
return;
}
示例8: BSCharacter
public BSCharacter(uint localID, String avName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, bool isFlying)
: base(parent_scene, localID, avName, "BSCharacter")
{
_physicsActorType = (int)ActorTypes.Agent;
_position = pos;
_flying = isFlying;
_orientation = OMV.Quaternion.Identity;
_velocity = OMV.Vector3.Zero;
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
Friction = BSParam.AvatarStandingFriction;
Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor;
// 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();
SetupMovementMotor();
DetailLog("{0},BSCharacter.create,call,size={1},scale={2},density={3},volume={4},mass={5}",
LocalID, _size, Scale, Density, _avatarVolume, RawMass);
// do actual creation in taint time
PhysicsScene.TaintedObject("BSCharacter.create", delegate()
{
DetailLog("{0},BSCharacter.create,taint", LocalID);
// New body and shape into PhysBody and PhysShape
PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this);
SetPhysicalProperties();
});
return;
}
示例9: BSPrim
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);
_physicsActorType = (int)ActorTypes.Prim;
_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;
// Add a dynamic vehicle to our set of actors that can move this prim.
VehicleActor = new BSDynamics(PhysicsScene, this, VehicleActorName);
PhysicalActors.Add(VehicleActorName, VehicleActor);
//PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysicsScene, this, VehicleActorName));
_mass = CalculateMass();
// DetailLog("{0},BSPrim.constructor,call", LocalID);
// do the actual object creation at taint time
PhysicsScene.TaintedObject(LocalID, "BSPrim.create", delegate()
{
// Make sure the object is being created with some sanity.
ExtremeSanityCheck(true /* inTaintTime */);
CreateGeomAndObject(true);
CurrentCollisionFlags = PhysicsScene.PE.GetCollisionFlags(PhysBody);
IsInitialized = true;
});
}
示例10: MetricsInit
internal void MetricsInit(float timeStep,
OpenMetaverse.Quaternion vframe, OpenMetaverse.Quaternion rotation,
OpenMetaverse.Vector3 worldAngularVel, OpenMetaverse.Vector3 worldLinearVel,
OpenMetaverse.Vector3 localAngularVel, OpenMetaverse.Vector3 localLinearVel)
{
this.timeStep = timeStep;
this.vframe = vframe;
this.rotation = rotation;
this.worldAngularVel = worldAngularVel;
this.worldLinearVel = worldLinearVel;
this.localAngularVel = localAngularVel;
this.localLinearVel = localLinearVel;
}
示例11: rotate
/// <summary>
/// rotate the specified amounts around the camera's local axis
/// </summary>
/// <param name="X"></param>
/// <param name="Y"></param>
/// <param name="Z"></param>
public void rotate(float X, float Y, float Z)
{
if (YawFixed) {
// some of the rotation is around X
OMV.Quaternion xvec = OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitX, X);
xvec.Normalize();
// some of the rotation is around Z
OMV.Quaternion zvec = OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitZ, Z);
zvec.Normalize();
m_heading = zvec * m_heading;
m_heading = m_heading * xvec;
}
else {
OMV.Quaternion rot = new OMV.Quaternion(X, Y, Z);
rot.Normalize();
rotate(rot);
}
}
示例12: UpdateCamera
// ==========================================================================
/// <summary>
/// Update the camera. The coordinate system from the EntityCamera is LL's
/// (Z up). We have to convert the rotation and position to Ogre coords
/// (Y up).
/// </summary>
/// <param name="cam"></param>
// private bool haveAttachedCamera = false;
public void UpdateCamera(CameraControl cam)
{
/* Historical Note: This is part of code to attach the camera to the avatar. When this was written
* the avatar code was not in place so the actual scene node to attach the camera too is problematic.
* Fix this when there is an avatar.
if (!haveAttachedCamera && cam.AssociatedAgent != null && cam.AssociatedAgent.AssociatedAvatar != null) {
m_log.Log(LogLevel.DVIEWDETAIL, "OnAgentUpdate: Attaching camera with {0}", cam.AssociatedAgent.AssociatedAvatar.Name);
haveAttachedCamera = Ogr.AttachCamera(cam.AssociatedAgent.AssociatedAvatar.Name.Name, 1.0f, 0.0f, 1.0f, 0f, 0f, 0f, 1f);
}
*/
// OMV.Quaternion orient = new OMV.Quaternion(OMV.Vector3.UnitX, -Constants.PI / 2)
// * new OMV.Quaternion(OMV.Vector3.UnitZ, -Constants.PI / 2)
// * cam.Direction;
// we need to rotate the camera 90 to make it work out in Ogre. Not sure why.
// OMV.Quaternion orient = cam.Heading * OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitZ, -Constants.PI / 2);
OMV.Quaternion orient = OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitZ, -Constants.PI / 2) * cam.Heading;
// OMV.Quaternion orient = cam.Heading;
orient.Normalize();
m_lastCameraPosition = cam.GlobalPosition;
m_lastCameraOrientation = orient;
// note the conversion from LL coordinates (Z up) to Ogre coordinates (Y up)
OMV.Vector3d pos = cam.GlobalPosition * m_sceneMagnification;
Ogr.UpdateCameraBF(pos.X, pos.Z, -pos.Y,
orient.W, orient.X, orient.Z, -orient.Y,
1.0f, (float)cam.Far*m_sceneMagnification, 1.0f);
// m_log.Log(LogLevel.DRENDERDETAIL, "UpdateCamera: Camera to p={0}, r={1}", pos, orient);
return;
}
示例13: AddPrimShape
public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
Vector3 size, Quaternion rotation, bool isPhysical)
{
return AddPrim(position, size, rotation);
}
示例14: ResetLink
// Set all the parameters for this constraint to a fixed, non-movable constraint.
public override void ResetLink()
{
// constraintType = ConstraintType.D6_CONSTRAINT_TYPE;
constraintType = ConstraintType.BS_FIXED_CONSTRAINT_TYPE;
linearLimitLow = OMV.Vector3.Zero;
linearLimitHigh = OMV.Vector3.Zero;
angularLimitLow = OMV.Vector3.Zero;
angularLimitHigh = OMV.Vector3.Zero;
useFrameOffset = BSParam.LinkConstraintUseFrameOffset;
enableTransMotor = BSParam.LinkConstraintEnableTransMotor;
transMotorMaxVel = BSParam.LinkConstraintTransMotorMaxVel;
transMotorMaxForce = BSParam.LinkConstraintTransMotorMaxForce;
cfm = BSParam.LinkConstraintCFM;
erp = BSParam.LinkConstraintERP;
solverIterations = BSParam.LinkConstraintSolverIterations;
frameInAloc = OMV.Vector3.Zero;
frameInArot = OMV.Quaternion.Identity;
frameInBloc = OMV.Vector3.Zero;
frameInBrot = OMV.Quaternion.Identity;
useLinearReferenceFrameA = true;
springAxisEnable = new bool[6];
springDamping = new float[6];
springStiffness = new float[6];
for (int ii = 0; ii < springAxisEnable.Length; ii++)
{
springAxisEnable[ii] = false;
springDamping[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
springStiffness[ii] = BSAPITemplate.SPRING_NOT_SPECIFIED;
}
springLinearEquilibriumPoint = OMV.Vector3.Zero;
springAngularEquilibriumPoint = OMV.Vector3.Zero;
member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID);
}
示例15: BSPrim
public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size,
OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
{
// m_log.DebugFormat("{0}: BSPrim creation of {1}, id={2}", LogHeader, primName, localID);
_localID = localID;
_avName = primName;
_scene = parent_scene;
_position = pos;
_size = size;
_scale = new OMV.Vector3(1f, 1f, 1f); // the scale will be set by CreateGeom depending on object type
_orientation = rotation;
_buoyancy = 1f;
_velocity = OMV.Vector3.Zero;
_rotationalVelocity = OMV.Vector3.Zero;
_angularVelocity = OMV.Vector3.Zero;
_hullKey = 0;
_meshKey = 0;
_pbs = pbs;
_isPhysical = pisPhysical;
_isVolumeDetect = false;
_subscribedEventsMs = 0;
_friction = _scene.Params.defaultFriction; // TODO: compute based on object material
_density = _scene.Params.defaultDensity; // TODO: compute based on object material
_restitution = _scene.Params.defaultRestitution;
_parentPrim = null; // not a child or a parent
_vehicle = new BSDynamics(this); // add vehicleness
_childrenPrims = new List<BSPrim>();
if (_isPhysical)
_mass = CalculateMass();
else
_mass = 0f;
// do the actual object creation at taint time
_scene.TaintedObject(delegate()
{
RecreateGeomAndObject();
});
}