public override MyStringHash GetMaterialAt(Vector3D worldPos) { var material = m_voxelMap.GetMaterialAt(ref worldPos); //Debug.Assert(material != null); return(material != null?MyStringHash.GetOrCompute(material.MaterialTypeName) : MyStringHash.NullOrEmpty); }
public override void ContactPointCallback(ref MyGridContactInfo value) { //return; var prop = value.Event.ContactProperties; prop.Friction = Friction; prop.Restitution = 0.5f; value.EnableParticles = false; value.RubberDeformation = true; string particle = null; if (value.CollidingEntity is MyVoxelBase && MyFakes.ENABLE_DRIVING_PARTICLES) { MyVoxelBase voxel = value.CollidingEntity as MyVoxelBase; Vector3D contactPosition = value.ContactPosition; MyStringHash material = MyStringHash.GetOrCompute(voxel.GetMaterialAt(ref contactPosition).MaterialTypeName); particle = MyMaterialPropertiesHelper.Static.GetCollisionEffect(MyMaterialPropertiesHelper.CollisionType.Start, m_wheelStringHash, material); } else if (value.CollidingEntity is MyCubeGrid && MyFakes.ENABLE_DRIVING_PARTICLES) { MyCubeGrid grid = value.CollidingEntity as MyCubeGrid; MyStringHash material = grid.Physics.GetMaterialAt(value.ContactPosition); particle = MyMaterialPropertiesHelper.Static.GetCollisionEffect(MyMaterialPropertiesHelper.CollisionType.Start, m_wheelStringHash, material); } if (Render != null && particle != null) { Render.TrySpawnParticle(value.ContactPosition, particle); } }
public override void ContactPointCallback(ref MyGridContactInfo value) { //return; var prop = value.Event.ContactProperties; prop.Friction = Friction; prop.Restitution = 0.5f; value.EnableParticles = false; value.RubberDeformation = true; if (value.CollidingEntity is MyVoxelBase) { MyVoxelBase voxel = value.CollidingEntity as MyVoxelBase; Vector3D contactPosition = value.ContactPosition; MyParticleEffectsIDEnum particleEffect = voxel.GetMaterialAt(ref contactPosition).ParticleEffect; if (Render != null && particleEffect != MyParticleEffectsIDEnum.None) { Render.TrySpawnParticle(value.ContactPosition, particleEffect); } } }