本文整理汇总了C#中OpenMetaverse.Vector3类的典型用法代码示例。如果您正苦于以下问题:C# Vector3类的具体用法?C# Vector3怎么用?C# Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3类属于OpenMetaverse命名空间,在下文中一共展示了Vector3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearDisplacement
// Clears any center-of-mass displacement introduced by linksets, etc.
// Does not clear the displacement set by the user.
public void ClearDisplacement()
{
if (UserSetCenterOfMassDisplacement.HasValue)
PositionDisplacement = (OMV.Vector3)UserSetCenterOfMassDisplacement;
else
PositionDisplacement = OMV.Vector3.Zero;
}
示例2: BSLinksetCompoundInfo
public BSLinksetCompoundInfo(int indx, OMV.Vector3 p, OMV.Quaternion r)
{
Index = indx;
OffsetFromRoot = p;
OffsetFromCenterOfMass = p;
OffsetRot = r;
}
示例3: Clear
public override void Clear()
{
Index = 0;
OffsetFromRoot = OMV.Vector3.Zero;
OffsetFromCenterOfMass = OMV.Vector3.Zero;
OffsetRot = OMV.Quaternion.Identity;
}
示例4: BSPhysObject
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
{
PhysicsScene = parentScene;
LocalID = localID;
PhysObjectName = name;
Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
TypeName = typeName;
// Initialize variables kept in base.
GravModifier = 1.0f;
Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);
// We don't have any physical representation yet.
PhysBody = new BulletBody(localID);
PhysShape = new BulletShape();
LastAssetBuildFailed = false;
// Default material type. Also sets Friction, Restitution and Density.
SetMaterial((int)MaterialAttributes.Material.Wood);
CollisionCollection = new CollisionEventUpdate();
CollisionsLastTick = CollisionCollection;
SubscribedEventsMs = 0;
CollidingStep = 0;
CollidingGroundStep = 0;
CollisionAccumulation = 0;
ColliderIsMoving = false;
CollisionScore = 0;
// All axis free.
LockedAxis = LockedAxisFree;
}
示例5: 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);
}
示例6: AnimatPosition
/// <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;
}
示例7: 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;
// 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;
// A motor to control the acceleration and deceleration of the avatar movement.
// _velocityMotor = new BSVMotor("BSCharacter.Velocity", 3f, 5f, BSMotor.InfiniteVector, 1f);
// _velocityMotor = new BSPIDVMotor("BSCharacter.Velocity", 3f, 5f, BSMotor.InfiniteVector, 1f);
// Infinite decay and timescale values so motor only changes current to target values.
_velocityMotor = new BSVMotor("BSCharacter.Velocity",
0.2f, // time scale
BSMotor.Infinite, // decay time scale
BSMotor.InfiniteVector, // friction timescale
1f // efficiency
);
_velocityMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages.
_flying = isFlying;
_orientation = OMV.Quaternion.Identity;
_velocity = OMV.Vector3.Zero;
_appliedVelocity = OMV.Vector3.Zero;
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
_currentFriction = BSParam.AvatarStandingFriction;
_avatarDensity = BSParam.AvatarDensity;
// 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);
// 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}",
LocalID, _size, Scale, _avatarDensity, _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;
}
示例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;
_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;
}
示例9: AnimatFixedRotation
/// <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 AnimatFixedRotation(IAnimation anim, uint id)
: base(AnimatBase.AnimatTypeFixedRotation)
{
m_infoID = id;
if (anim.DoStaticRotation) {
m_rotationsPerSecond = anim.StaticRotationRotPerSec;
m_rotationAxis = anim.StaticRotationAxis;
}
else {
// shouldn't get here
m_rotationsPerSecond = 1;
m_rotationAxis = OMV.Vector3.UnitX;
}
}
示例10: 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();
}
示例11: 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;
}
示例12: ResetToFixedConstraint
// Set all the parameters for this constraint to a fixed, non-movable constraint.
public void ResetToFixedConstraint()
{
constraintType = ConstraintType.D6_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;
}
示例13: 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;
_appliedVelocity = OMV.Vector3.Zero;
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
_currentFriction = PhysicsScene.Params.avatarStandingFriction;
_avatarDensity = PhysicsScene.Params.avatarDensity;
// 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);
// 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}",
LocalID, _size, Scale, _avatarDensity, _avatarVolume, MassRaw);
ShapeData shapeData = new ShapeData();
shapeData.ID = LocalID;
shapeData.Type = ShapeData.PhysicsShapeType.SHAPE_AVATAR;
shapeData.Position = _position;
shapeData.Rotation = _orientation;
shapeData.Velocity = _velocity;
shapeData.Size = Scale; // capsule is a native shape but scale is not just <1,1,1>
shapeData.Scale = Scale;
shapeData.Mass = _mass;
shapeData.Buoyancy = _buoyancy;
shapeData.Static = ShapeData.numericFalse;
shapeData.Friction = PhysicsScene.Params.avatarStandingFriction;
shapeData.Restitution = PhysicsScene.Params.avatarRestitution;
// do actual create at taint time
PhysicsScene.TaintedObject("BSCharacter.create", delegate()
{
DetailLog("{0},BSCharacter.create,taint", LocalID);
// New body and shape into BSBody and BSShape
PhysicsScene.Shapes.GetBodyAndShape(true, PhysicsScene.World, this, shapeData, null, null, null);
SetPhysicalProperties();
});
return;
}
示例14: BSPhysObject
protected BSPhysObject(BSScene parentScene, uint localID, string name, string typeName)
{
IsInitialized = false;
PhysScene = parentScene;
LocalID = localID;
PhysObjectName = name;
Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
TypeName = typeName;
// The collection of things that push me around
PhysicalActors = new BSActorCollection(PhysScene);
// Initialize variables kept in base.
GravModifier = 1.0f;
Gravity = new OMV.Vector3(0f, 0f, BSParam.Gravity);
HoverActive = false;
// We don't have any physical representation yet.
PhysBody = new BulletBody(localID);
PhysShape = new BSShapeNull();
UserSetCenterOfMassDisplacement = null;
PrimAssetState = PrimAssetCondition.Unknown;
// Default material type. Also sets Friction, Restitution and Density.
SetMaterial((int)MaterialAttributes.Material.Wood);
CollisionCollection = new CollisionEventUpdate();
CollisionsLastReported = CollisionCollection;
CollisionsLastTick = new CollisionEventUpdate();
CollisionsLastTickStep = -1;
SubscribedEventsMs = 0;
// Crazy values that will never be true
CollidingStep = BSScene.NotASimulationStep;
CollidingGroundStep = BSScene.NotASimulationStep;
CollisionAccumulation = BSScene.NotASimulationStep;
ColliderIsMoving = false;
CollisionScore = 0;
// All axis free.
LockedLinearAxis = LockedAxisFree;
LockedAngularAxis = LockedAxisFree;
}
示例15: 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;
});
}