Enable hinge joint and car door physics on collision unity3d | Simple car hit effect in unity3d

Subscribers:
1,110
Published on ● Video Link: https://www.youtube.com/watch?v=ny5l-MJuspM



Duration: 4:00
158 views
13


Link of last video :
https://www.youtube.com/watch?v=DFWXdofQIV4

Code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class JointEnabler : MonoBehaviour
{
public float speedtoEnable = 10f;
public HingeJoint leftDoor, rightDoor;

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{

}

private void OnCollisionEnter(Collision collision)
{
if (collision.relativeVelocity.magnitude "greater than sign" speedtoEnable)
{
JointLimits leftLimits = leftDoor.limits;
JointLimits rightLimits = rightDoor.limits;

leftLimits.min = 0;
leftLimits.max = 70f;

rightLimits.min = -70;
rightLimits.max = 0f;

leftDoor.limits = leftLimits;
rightDoor.limits = rightLimits;
}
}


}

/////////////////////////////////////////////////////////////////////////////////////////
/*
ASSALAM o alaikum
All codes and concepts and videos from this channel are non copyrighted and free to use because we believe that knowledge should be freely available for everyone
*/
/////////////////////////////////////////////////////////////////////////////////////////////




Other Videos By Muhammad Shahzaib


2022-09-15Solved You uploaded a debuggable APK or Android App Bundle unity
2022-09-14Camera follow jerk issue solution in unity3d
2022-09-13Find and change shortcut keys in unity tutorial | Shotcut keys in unity
2022-09-12Detect Button is held or being pressed in unity easy tutorial
2022-09-11Make world UI always always look at camera unity tutorial | Rotate gameObject towards camera unity
2022-09-04Effect all ui elements in group using Canvas Group unity| Canvas Group in unity
2022-09-04Attach trailer with truck using joints in unity3d
2022-08-31Balance rigidbody in unity3d | Balance rigidbody character from fall on hitting unity
2022-08-31When your game character is too much down to earth
2022-08-29Develop sun in unity3d | Add custom sun in unity3d | Lens flare in unity3d
2022-08-28Enable hinge joint and car door physics on collision unity3d | Simple car hit effect in unity3d
2022-08-27GTA like car doors effect in unity3d | Unity door physics | Hinge joint in unity
2022-08-24Wind Zone in unity | Bend trees using wind zone in unity | How to add trees on terrain
2022-08-23Simple waypoint follow AI in unity | Patrolling AI in unity3d | Waypoint system unity
2022-08-21Add 3D Text in unity3D
2022-08-21Change default editor in unity
2022-08-17Auto adjust Ui elements in grid Unity | Grid Layout group unity
2022-08-16Auto adjust ui elements in a column unity | Vertical Layout group in unity
2022-08-12Analog Clock in unity3d demo with ticking ASMR
2022-08-09Digital Clock in unity full tutorial
2022-08-09UI elements infinite rendering bug and solution



Tags:
learn unity
unity tutorials
unity programming
joints in unity
unity hinge joint
enabling hinge joint on run time unity
unity car hit effect
collision detection in unity
speed of collision in unity