- Home /
 
 
               Question by 
               $$anonymous$$ · Aug 14, 2019 at 01:59 AM · 
                c#physicscarcar physics  
              
 
              OnCollisionEnter doesn't work: changing wheelcollider's sideway friction stiffness
Iam trying to change a value in a component but it doesn't work, here is my code:
I've tried to initialize the variables outside the method but it gives me an error, because I initialized the wheel colliders (FDW,FPW,BDW,BPW) first
  private void Slip()
 {
     //FPW, FDW, BPW, and BDW are all wheel colliders
     float stiffness1 = FPW.sidewaysFriction.stiffness;
     float stiffness2 = FDW.sidewaysFriction.stiffness;
     float stiffness3 = BPW.sidewaysFriction.stiffness;
     float stiffness4 = BDW.sidewaysFriction.stiffness;
 
     stiffness1 = 5;
     stiffness2 = 5;
     stiffness3 = 5;
     stiffness4 = 5;
 }
 
 private void OnCollisionEnter()
 {
     Slip();
 }
 
              
               Comment
              
 
               
              for anyone who wants to know what am I trying to do, Iam trying to make car the slips when hit but doesn't drift too much... something like how the cars in gta act
Your answer