// Use this for initialization private void Start() { originalStructure = new List<Transform> (GetComponentsInChildren<Transform> ()); originalPosition = transform.position; originalRotation = transform.rotation; Rigidbody = GetComponent<Rigidbody> (); }
public static _3D_ATTRIBUTES to3DAttributes(GameObject go, Rigidbody rigidbody = null) { FMOD.Studio._3D_ATTRIBUTES attributes = new FMOD.Studio._3D_ATTRIBUTES(); attributes.forward = toFMODVector(go.transform.forward); attributes.up = toFMODVector(go.transform.up); attributes.position = toFMODVector(go.transform.position); if (rigidbody) attributes.velocity = toFMODVector(rigidbody.velocity); return attributes; }
private static void INTERNAL_CALL_MovePosition(Rigidbody self, ref Vector3 position){}
public void Start() { this.enemiesInAttackRange = new List<BaseUnit>(); this.removeList = new List<BaseUnit>(); this.exitedList = new List<BaseUnit>(); this.parent = this.GetComponentInParent<GameUnit>(); this.sphereColliderRigidBody = this.GetComponent<Rigidbody>(); this.otherEnemies = new List<BaseUnit>(); }
/// <inheritdoc/> protected internal override bool IsValidParent(Rigidbody parent) { // Triangle mesh colliders cannot be used for non-kinematic rigidbodies return mesh == null|| mesh.MeshType == PhysicsMeshType.Convex || parent.Kinematic; }
private static Vector3 INTERNAL_CALL_GetPointVelocity(Rigidbody self, ref Vector3 worldPoint){}
void Start() { tr = transform; rb = (Rigidbody)F.GetTopmostParentComponent <Rigidbody>(tr); vp = (VehicleParent)F.GetTopmostParentComponent <VehicleParent>(tr); suspensionParent = tr.parent.GetComponent <Suspension>(); travelDist = suspensionParent.targetCompression; canDetach = detachForce < Mathf.Infinity && Application.isPlaying; initialTirePressure = tirePressure; if (tr.childCount > 0) { //Get rim rim = tr.GetChild(0); //Set up rim glow material if (rimGlow > 0 && Application.isPlaying) { rimMat = new Material(rim.GetComponent <MeshRenderer>().sharedMaterial); rimMat.EnableKeyword("_EMISSION"); rim.GetComponent <MeshRenderer>().material = rimMat; } //Create detached wheel if (canDetach) { detachedWheel = new GameObject(vp.transform.name + "'s Detached Wheel"); detachedWheel.layer = LayerMask.NameToLayer("Detachable Part"); detachFilter = detachedWheel.AddComponent <MeshFilter>(); detachFilter.sharedMesh = rim.GetComponent <MeshFilter>().sharedMesh; MeshRenderer detachRend = detachedWheel.AddComponent <MeshRenderer>(); detachRend.sharedMaterial = rim.GetComponent <MeshRenderer>().sharedMaterial; detachedCol = detachedWheel.AddComponent <MeshCollider>(); detachedCol.convex = true; detachedBody = detachedWheel.AddComponent <Rigidbody>(); detachedBody.mass = mass; } //Get tire if (rim.childCount > 0) { tire = rim.GetChild(0); if (deformAmount > 0 && Application.isPlaying) { tireMat = new Material(tire.GetComponent <MeshRenderer>().sharedMaterial); tire.GetComponent <MeshRenderer>().material = tireMat; } //Create detached tire if (canDetach) { detachedTire = new GameObject("Detached Tire"); detachedTire.transform.parent = detachedWheel.transform; detachedTire.transform.localPosition = Vector3.zero; detachedTire.transform.localRotation = Quaternion.identity; detachTireFilter = detachedTire.AddComponent <MeshFilter>(); detachTireFilter.sharedMesh = tire.GetComponent <MeshFilter>().sharedMesh; MeshRenderer detachTireRend = detachedTire.AddComponent <MeshRenderer>(); detachTireRend.sharedMaterial = tireMat ? tireMat : tire.GetComponent <MeshRenderer>().sharedMaterial; } } if (Application.isPlaying) { //Generate hard collider if (generateHardCollider) { GameObject sphereColNew = new GameObject("Rim Collider"); sphereColNew.layer = GlobalControl.ignoreWheelCastLayer; sphereColTr = sphereColNew.transform; sphereCol = sphereColNew.AddComponent <SphereCollider>(); sphereColTr.parent = tr; sphereColTr.localPosition = Vector3.zero; sphereColTr.localRotation = Quaternion.identity; sphereCol.radius = Mathf.Min(rimWidth * 0.5f, rimRadius * 0.5f); sphereCol.material = GlobalControl.frictionlessMatStatic; } if (canDetach) { detachedWheel.SetActive(false); } } } targetDrive = GetComponent <DriveForce>(); currentRPM = 0; }
private static RaycastHit[] INTERNAL_CALL_SweepTestAll(Rigidbody self, ref Vector3 direction, float distance){}
private static void INTERNAL_CALL_AddForceAtPosition(Rigidbody self, ref Vector3 force, ref Vector3 position, ForceMode mode){}
private void Start() { ani = GetComponent<Animator>(); rig = GetComponent<Rigidbody>(); }
// Start is called before the first frame update void Start() { rig = GetComponent <Rigidbody>(); Gravity = new Vector3(0, -9.8f, 0); }
public void ActivateAndPull(Rigidbody rb) { affectedRigidbodies.Add(rb); }
public void RemoveFromPull(Rigidbody rb) { affectedRigidbodies.Remove(rb); }
void Start() { _playerRigidbody = FindObjectOfType <PlayerController>().GetComponent <Rigidbody>(); EventManager.Instance.StartListening(TouchEvent.EventName, OnTouch); }
void Awake() { rigidbody = GetComponent <Rigidbody> (); rigidbodyFPC = GetComponent <RigidbodyFirstPersonController> (); headBob = GetComponentInChildren <HeadBob> (); }
// Use this for initialization void Start() { _rb = gameObject.GetComponent <Rigidbody>(); _player = GameObject.Find("Player").transform; _spriteRenderer = GetComponent <SpriteRenderer>(); }
private static void INTERNAL_CALL_Sleep(Rigidbody self){}
void Start() { RigidBody = GetComponent <Rigidbody>(); MonsterState = MonsterState.IDLE; }
private static void INTERNAL_CALL_WakeUp(Rigidbody self){}
void Start() { enemyRb = GetComponent <Rigidbody>(); player = GameObject.Find("Player"); }
private static void INTERNAL_CALL_AddForce(Rigidbody self, ref Vector3 force, ForceMode mode){}
private void Awake() { this.m_RigidBody3D = this.GetComponent<Rigidbody>(); this.m_RigidBody2D = this.GetComponent<Rigidbody2D>(); this.m_CharacterController = this.GetComponent<CharacterController>(); this.m_PrevPosition = this.transform.position; this.m_PrevRotation = this.transform.rotation; this.m_PrevVelocity = 0.0f; if (!this.localPlayerAuthority) return; this.m_LocalTransformWriter = new NetworkWriter(); }
private static Vector3 INTERNAL_CALL_ClosestPointOnBounds(Rigidbody self, ref Vector3 position){}
void Awake() { body = GetComponent <Rigidbody>(); body.useGravity = false; OnValidate(); }
void Start() { rb = GetComponent <Rigidbody>(); bull = GameObject.FindGameObjectWithTag("Player").GetComponent <Bullet>(); time = FindObjectOfType <TimeManager>(); }
private void Awake() { rig = GetComponent <Rigidbody>(); cam = transform.GetChild(0); }
protected override bool DetectSetup() { finalDirection = (direction == ButtonDirection.autodetect ? DetectDirection() : direction); if (finalDirection == ButtonDirection.autodetect) { activationDir = Vector3.zero; return false; } if (direction != ButtonDirection.autodetect) { activationDir = CalculateActivationDir(); } if (buttonForce) { buttonForce.force = GetForceVector(); } if (Application.isPlaying) { buttonJoint = GetComponent<ConfigurableJoint>(); bool recreate = false; Rigidbody oldBody = null; Vector3 oldAnchor = Vector3.zero; Vector3 oldAxis = Vector3.zero; if (buttonJoint) { // save old values, needs to be recreated oldBody = buttonJoint.connectedBody; oldAnchor = buttonJoint.anchor; oldAxis = buttonJoint.axis; DestroyImmediate(buttonJoint); recreate = true; } // since limit applies to both directions object needs to be moved halfway to activation before adding joint transform.position = transform.position + ((activationDir.normalized * activationDistance) * 0.5f); buttonJoint = gameObject.AddComponent<ConfigurableJoint>(); if (recreate) { buttonJoint.connectedBody = oldBody; buttonJoint.anchor = oldAnchor; buttonJoint.axis = oldAxis; } if (connectedTo) { buttonJoint.connectedBody = connectedTo.GetComponent<Rigidbody>(); } SoftJointLimit buttonJointLimits = new SoftJointLimit(); buttonJointLimits.limit = activationDistance * 0.501f; // set limit to half (since it applies to both directions) and a tiny bit larger since otherwise activation distance might be missed buttonJoint.linearLimit = buttonJointLimits; buttonJoint.angularXMotion = ConfigurableJointMotion.Locked; buttonJoint.angularYMotion = ConfigurableJointMotion.Locked; buttonJoint.angularZMotion = ConfigurableJointMotion.Locked; buttonJoint.xMotion = ConfigurableJointMotion.Locked; buttonJoint.yMotion = ConfigurableJointMotion.Locked; buttonJoint.zMotion = ConfigurableJointMotion.Locked; switch (finalDirection) { case ButtonDirection.x: case ButtonDirection.negX: if (Mathf.RoundToInt(Mathf.Abs(transform.right.x)) == 1) { buttonJoint.xMotion = ConfigurableJointMotion.Limited; } else if (Mathf.RoundToInt(Mathf.Abs(transform.up.x)) == 1) { buttonJoint.yMotion = ConfigurableJointMotion.Limited; } else if (Mathf.RoundToInt(Mathf.Abs(transform.forward.x)) == 1) { buttonJoint.zMotion = ConfigurableJointMotion.Limited; } break; case ButtonDirection.y: case ButtonDirection.negY: if (Mathf.RoundToInt(Mathf.Abs(transform.right.y)) == 1) { buttonJoint.xMotion = ConfigurableJointMotion.Limited; } else if (Mathf.RoundToInt(Mathf.Abs(transform.up.y)) == 1) { buttonJoint.yMotion = ConfigurableJointMotion.Limited; } else if (Mathf.RoundToInt(Mathf.Abs(transform.forward.y)) == 1) { buttonJoint.zMotion = ConfigurableJointMotion.Limited; } break; case ButtonDirection.z: case ButtonDirection.negZ: if (Mathf.RoundToInt(Mathf.Abs(transform.right.z)) == 1) { buttonJoint.xMotion = ConfigurableJointMotion.Limited; } else if (Mathf.RoundToInt(Mathf.Abs(transform.up.z)) == 1) { buttonJoint.yMotion = ConfigurableJointMotion.Limited; } else if (Mathf.RoundToInt(Mathf.Abs(transform.forward.z)) == 1) { buttonJoint.zMotion = ConfigurableJointMotion.Limited; } break; } } return true; }
void Start() { body = GetComponent <Rigidbody>(); sound = GetComponent <AudioSource>(); PreLaunch(); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); Grounded = true; }
public static void AttachInstanceToGameObject(FMOD.Studio.EventInstance instance, Transform transform, Rigidbody rigidBody) { var attachedInstance = new AttachedInstance(); attachedInstance.transform = transform; attachedInstance.instance = instance; attachedInstance.rigidBody = rigidBody; Instance.attachedInstances.Add(attachedInstance); }
/// <inheritdoc/> protected internal override bool IsValidParent(Rigidbody parent) { // Planes cannot be added to non-kinematic rigidbodies return parent.Kinematic; }
public static void SetListenerLocation(GameObject gameObject, Rigidbody rigidBody = null) { Instance.studioSystem.setListenerAttributes(0, RuntimeUtils.To3DAttributes(gameObject, rigidBody)); }
// Use this for initialization void Awake() { mPlayer = GameObject.FindGameObjectWithTag("Player").GetComponent<CPlayerCtrl>(); mRigidbody = GetComponent<Rigidbody>(); }
void Start() { rb = GetComponent <Rigidbody>(); //use the rigidbody component to get our object }
private static void INTERNAL_CALL_MoveRotation(Rigidbody self, ref Quaternion rot){}
void Start() { force = 500; rigidBody = GetComponent <Rigidbody>(); rigidBody.AddExplosionForce(force, transform.position + Random.insideUnitSphere * 5, 20, 20); }
private static bool INTERNAL_CALL_IsSleeping(Rigidbody self){}
public override void OnEnable() => Component = gameObject.GetComponent <Rigidbody>();
private static bool INTERNAL_CALL_SweepTest(Rigidbody self, ref Vector3 direction, out RaycastHit hitInfo, float distance){}
private float powerupStrength = 25; // how hard to hit enemy with powerup void Start() { playerRb = GetComponent <Rigidbody>(); focalPoint = GameObject.Find("Focal Point"); }
private static void INTERNAL_CALL_SetDensity(Rigidbody self, float density){}
void Start() { Destroy(gameObject, 60); rb = GetComponent <Rigidbody>(); }
private static void INTERNAL_CALL_AddRelativeTorque(Rigidbody self, ref Vector3 torque, ForceMode mode){}
void Start() { rb = GetComponent <Rigidbody>(); transform.parent = null; }
private static void INTERNAL_CALL_AddExplosionForce(Rigidbody self, float explosionForce, ref Vector3 explosionPosition, float explosionRadius, float upwardsModifier, ForceMode mode){}
void Start() { thisRigidbody = GetComponent <Rigidbody>(); Cursor.visible = false; }
private static Vector3 INTERNAL_CALL_GetRelativePointVelocity(Rigidbody self, ref Vector3 relativePoint){}
/// <summary> /// Connect new car joint to front car /// </summary> /// <param name="newTrainCar"></param> /// <param name="previousCarCoupler"></param> public static void ConnectTrainCar(HingeJoint newTrainCar, Rigidbody frontCarCoupler) { newTrainCar.connectedBody = frontCarCoupler; }
////////////////////////////////////////////////////////////////////////////// // // //Unity Functions // // // ////////////////////////////////////////////////////////////////////////////// // Use this for initialization void Start() { rb = GetComponent<Rigidbody>(); }
// Start is called before the first frame update void Start() { rigidbodyComponent = GetComponent <Rigidbody>(); }
private void SetupRigidbody(bool isKinematic) { rigidbody = new Rigidbody(position, size, isKinematic); }
private void Start() { rb = GetComponent <Rigidbody>(); }
// Start is called before the first frame update void Start() { RB = GetComponent <Rigidbody>(); }
private void Start() { this._board = PlayerController.Instance.boardController.boardRigidbody; this._backTruck = PlayerController.Instance.boardController.backTruckRigidbody; this._frontTruck = PlayerController.Instance.boardController.frontTruckRigidbody; }