public void ActualUpdate() { if (!enabled) { return; } m_force_data.info.shape_type = m_shape_type; m_force_data.info.dir_type = m_direction_type; m_force_data.info.strength = m_strength_near; m_force_data.info.random_diffuse = m_random_diffuse; m_force_data.info.random_seed = m_random_seed; m_force_data.info.direction = m_direction; m_force_data.info.center = transform.position; m_force_data.info.rcp_cellsize = new Vector3(1.0f / m_vectorfield_cellsize.x, 1.0f / m_vectorfield_cellsize.y, 1.0f / m_vectorfield_cellsize.z); if (m_shape_type == CSForceShape.Sphere) { m_force_data.sphere.center = transform.position; m_force_data.sphere.radius = transform.localScale.x; } else if (m_shape_type == CSForceShape.Box) { CSImpl.BuildBox(ref m_force_data.box, transform.localToWorldMatrix, Vector3.one); } EachTargets((t) => { t.AddForce(ref m_force_data); }); }
void Blow() { TestShooter ts = TestShooter.instance; if (ts.gameMode == TestShooter.GameMode.Exception) { Vector3 pos = trans.position; float strength = 2000.0f; CSForce force = new CSForce(); force.info.shape_type = CSForceShape.Box; force.info.dir_type = CSForceDirection.Radial; force.info.strength = strength; force.info.center = pos - (trans.forward * 6.0f); CSImpl.BuildBox(ref force.box, blowMatrix, Vector3.one); GPUParticleWorld.GetInstances().ForEach((t) => { t.AddForce(ref force); }); } }
void Update() { Vector3 s = transform.localScale; Matrix4x4 bt = Matrix4x4.identity; bt.SetColumn(3, new Vector4(0.0f, 0.0f, 0.5f, 1.0f)); bt = Matrix4x4.Scale(new Vector3(s.x, s.y, s.z * range)) * bt; forceMatrix = transform.localToWorldMatrix * bt; CSForce force = new CSForce(); force.info.shape_type = CSForceShape.Box; force.info.dir_type = CSForceDirection.Directional; force.info.strength = strength; force.info.direction = transform.forward; CSImpl.BuildBox(ref force.box, forceMatrix, Vector3.one); GPUParticleWorld.GetInstances().ForEach((t) => { t.AddForce(ref force); }); foreach (Transform child in transform) { child.Rotate(new Vector3(0.0f, 0.0f, 1.0f), strength * 0.33f); } }