public void DrawFrictionChart() { var friction = new Friction(); friction.FrictionVolumeChart(genReport); friction.FrictionRFChart(genReport); }
public static void LerpSidewaysFriction(WheelCollider wheel, WheelFrictions from, WheelFrictions to, float factor) { var friction = wheel.sidewaysFriction; Friction.LerpFriction(ref friction, from.sideways, to.sideways, factor); wheel.sidewaysFriction = friction; }
private void Start() { m_Rigidbody = GetComponent <Rigidbody>(); m_Friction = GetComponent <Friction>(); m_ParText.text = m_Par.ToString(); m_ShotText.text = "0"; }
public static void LerpForwardFriction(WheelCollider wheel, WheelFrictions from, WheelFrictions to, float factor) { var friction = wheel.forwardFriction; Friction.LerpFriction(ref friction, from.forward, to.forward, factor); wheel.forwardFriction = friction; }
private void Start() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); fs = GetComponent <Friction>(); movementForce = rb.mass * (acceleration + GameManager.instance.globalFriction); airForce = rb.mass * acceleration; }
Friction fs; //Kitka scripti void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; rb = GetComponent <Rigidbody2D>(); spawnPoint = transform.position; anim = GetComponent <Animator>(); ehScript = GetComponent <EnemyHealth>(); movementForce = rb.mass * (acceleration + GameManager.instance.globalFriction); fs = GetComponent <Friction>(); }
public override float SendTorque(float torque, float inertiaSum, float dt) { float outTorque = 0; float returnTorque = Friction.CalculateLongitudinalSlip(torque, _brakeTorque, wheelController.dragTorque, _radius, inertia, dt, _fixedDeltaTime, _loadCoefficient, _BCDEz, ref wheelController.forwardFriction, ref wheelController.wheel.angularVelocity, ref outTorque); angularVelocity = wheelController.wheel.angularVelocity; _outputTorque += outTorque; return(returnTorque); }
public CollisionResponse(CollistionDetails CollistionDetail) { this.CollisionForceVector = CollistionDetail.hitforcevector; this.CollisionPoint3D = CollistionDetail.intersectionPoint; this.PlaneNormal = CollistionDetail.PlaneNormal; FrictionForce = new Friction( CollistionDetail.DistanceFromCenterOfMass, CollisionForceVector ); }
public bool Equals(PhysicalProperties other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Enabled == other.Enabled && Density.Equals(other.Density) && Friction.Equals(other.Friction) && Elasticity.Equals(other.Elasticity) && FrictionWeight.Equals(other.FrictionWeight) && ElasticityWeight.Equals(other.ElasticityWeight)); }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("MaterialType", true, out subEle); subEle.Value = MaterialType.ToString(); ele.TryPathTo("Friction", true, out subEle); subEle.Value = Friction.ToString(); ele.TryPathTo("Restitution", true, out subEle); subEle.Value = Restitution.ToString(); }
public override int GetHashCode() { unchecked { var hashCode = Enabled.GetHashCode(); hashCode = (hashCode * 397) ^ Density.GetHashCode(); hashCode = (hashCode * 397) ^ Friction.GetHashCode(); hashCode = (hashCode * 397) ^ Elasticity.GetHashCode(); hashCode = (hashCode * 397) ^ FrictionWeight.GetHashCode(); hashCode = (hashCode * 397) ^ ElasticityWeight.GetHashCode(); return(hashCode); } }
private void Awake() { if (!ForcePoint) { ForcePoint = GetComponentInChildren <Friction>(); } rb = GetComponent <Rigidbody2D>(); m_InitConstraints = GetComponent <Rigidbody2D>().constraints; force = rb.mass * Time.deltaTime * 3000; var Vec1 = joint2.position - joint1.position; var Vec2 = joint3.position - joint2.position; l1 = Vec1.magnitude; l2 = Vec2.magnitude; }
public void InitIfNull() { // Objects if (wheel == null) { wheel = new Wheel(); } if (hit == null) { hit = new WheelHit(); } if (spring == null) { spring = new Spring(); } if (damper == null) { damper = new Damper(); } if (fFriction == null) { fFriction = new Friction(); } if (sFriction == null) { sFriction = new Friction(); } // Curves if (springCurve == null) { springCurve = GenerateDefaultSpringCurve(); } if (damperCurve == null) { damperCurve = GenerateDefaultDamperCurve(); } if (sideFriction.frictionCurve == null) { sideFriction.frictionCurve = SetFrictionParams(sideFriction, new Vector4(10.0f, 1.9f, 1.0f, 0.97f)); } if (forwardFriction.frictionCurve == null) { forwardFriction.frictionCurve = SetFrictionParams(forwardFriction, new Vector4(10.0f, 1.9f, 1.0f, 0.97f)); } }
public void LoadGame(int value) { // Destroys all the planes and particles in the current scene. foreach (Selectable obj in FindObjectsOfType <Selectable>()) { Destroy(obj.gameObject); } // Gets the required game. Game game = SaveLoad.savedGames[value]; foreach (Particle p in game.particles) { // Creates a blank particle. GameObject g = GameObject.Instantiate(Resources.Load("Object")) as GameObject; // Gets the base and friction scripts. Base b = g.GetComponent <Base>(); Friction f = g.GetComponentInChildren <Friction>(); // Calls the starting method and sets the // position, coefficient, mass, force, velocity. b.Init(); b.Position = p.position.toVector(); f.Coefficient = p.coefficient; b.Mass = p.mass; b.Force = p.force.toVector(); b.Velocity = p.velocity.toVector(); } // Do the same for all the planes. foreach (PlaneObj plane in game.planes) { GameObject g = GameObject.Instantiate(Resources.Load("Plane")) as GameObject; PlaneBase b = g.GetComponent <PlaneBase>(); b.Rotation = plane.rotation.toVector(); b.Position = plane.position.toVector(); } // Sets the current game to the new game. Game.current = game; }
/// <summary> /// Sets BCDE values for friction and generates and sets a friction curve from those values. /// </summary> /// <param name="f">Forward (Longitudinal) or Sideways (Lateral) friction.</param> /// <param name="p">Friction parameters in Vector4 format [Vector4(B,C,D,E)].</param> public AnimationCurve SetFrictionParams(Friction f, Vector4 p) { f.frictionParams = p; return(f.frictionCurve = GenerateFrictionCurve(p)); }
public void Start() { m_Friction = GetComponent <Friction>(); m_StartingTime = Time.time; }
public static WheelFrictionCurve LerpFriction(ref WheelFrictionCurve curve, Friction from, Friction to, float factor) { curve.extremumSlip = Mathf.Lerp(from.extremumSlip, to.extremumSlip, factor); curve.extremumValue = Mathf.Lerp(from.extremumValue, to.extremumValue, factor); curve.asymptoteSlip = Mathf.Lerp(from.asymptoteSlip, to.asymptoteSlip, factor); curve.asymptoteValue = Mathf.Lerp(from.asymptoteValue, to.asymptoteValue, factor); curve.stiffness = Mathf.Lerp(from.stiffness, to.stiffness, factor); return(curve); }
// Ensure that the instance is destroyed when the game is stopped in the editor. void OnApplicationQuit() { instance = null; }
public WheelFrictions(WheelCollider wheel) { forward = new Friction(wheel.forwardFriction); sideways = new Friction(wheel.sidewaysFriction); }