private void UpdateMovement(Vector2 value) { SandboxObject parentSandboxObject = ((SandboxObject)parent); Vector3 scaledDirection = Vector3.zero; if (_data.velocityDirection == VelocityDirection.Local) { scaledDirection = base.transform.forward * value.y * _data.forwardMovementSpeed; scaledDirection += base.transform.right * value.x * _data.sidewaysMovementSpeed; } else if (_data.velocityDirection == VelocityDirection.Camera) { scaledDirection = parentSandboxObject.user.controllableCamera.transform.forward * value.y * _data.forwardMovementSpeed; scaledDirection += parentSandboxObject.user.controllableCamera.transform.right * value.x * _data.sidewaysMovementSpeed; } else { Vector3 forward = Quaternion.Euler(0, parentSandboxObject.user.controllableCamera.transform.eulerAngles.y, parentSandboxObject.user.controllableCamera.transform.eulerAngles.z) * Vector3.forward; scaledDirection = forward * value.y * _data.forwardMovementSpeed; scaledDirection += parentSandboxObject.user.controllableCamera.transform.right * value.x * _data.sidewaysMovementSpeed; } if (_data.applicationMethod == ApplicationMethod.Add) { parentSandboxObject.rigidbody.velocity += scaledDirection * Time.fixedDeltaTime; } else { parentSandboxObject.rigidbody.velocity = scaledDirection * Time.fixedDeltaTime; } }
protected ParticleSample(Microsoft.Xna.Framework.Game game) : base(game) { GraphicsScreen.ClearBackground = true; GraphicsScreen.BackgroundColor = Color.CornflowerBlue; SetCamera(new Vector3F(0, 2, 10), 0, 0); _sandboxObject = new SandboxObject(Services); GameObjectService.Objects.Add(_sandboxObject); }
public KinectRagdollMarionetteSample(Microsoft.Xna.Framework.Game game) : base(game) { SetCamera(new Vector3F(0, 1, 1), 0, 0); // Add a background object. _sandboxObject = new SandboxObject(Services); GameObjectService.Objects.Add(_sandboxObject); // Add a KinectWrapper which controls the Kinect device. _kinectWrapper = new KinectWrapper(game); game.Components.Add(_kinectWrapper); InitializeModelAndRagdoll(); InitializeMarionetteConstraints(); }
private void ApplyVelocity() { if (!GameHead.instance.isPreviewOrRuntime) { return; } SandboxObject sandboxObject = (SandboxObject)parent; Vector3 velocity = new Vector3(_data.velocityX, _data.velocityY, _data.velocityZ) * Time.fixedDeltaTime; if (_data.setType == SetType.Add) { sandboxObject.rigidbody.AddForce(velocity, ForceMode.Acceleration); } if (_data.setType == SetType.Set) { sandboxObject.rigidbody.velocity = velocity; } }
public KinectSkeletonMappingSample(Microsoft.Xna.Framework.Game game) : base(game) { SetCamera(new Vector3F(0, 1, 1), 0, 0); // Add a background object. _sandboxObject = new SandboxObject(Services); GameObjectService.Objects.Add(_sandboxObject); // Add a KinectWrapper which controls the Kinect device. _kinectWrapper = new KinectWrapper(game); game.Components.Add(_kinectWrapper); InitializeModels(); _filterA = new SkeletonPoseFilter(_meshNodeA.SkeletonPose); _filterB = new SkeletonPoseFilter(_meshNodeB.SkeletonPose); InitializeSkeletonMappers(); }
internal void PopulateLinkDatas() { int[] keys = _idModuleMap.Keys.ToArray(); foreach (int key in keys) { Module module = _idModuleMap[key]; if (module is ModuleLogicLink) { ModuleLogicLink link = (ModuleLogicLink)module; } else if (module is SandboxObject) { SandboxObject sandboxObject = (SandboxObject)module; sandboxObject.PopulateLinkDatas(); } else if (module is SandboxObjectReference) { SandboxObjectReference childSandboxObject = (SandboxObjectReference)module; childSandboxObject.PopulateLinkDatas(); } } }