- Home /
Bad grid rigibody3D collision
i have map of solid block(in 3D with x and z) and every block have box 3d collision and I have the vehicle with Rigibody3D but while I am adding force to the vehicle it get rotating by these solid blocks but that surface should be flat(smooth) and so a ride any solutions for this
Why not make a single big cube with a single box collider?
sometimes in that grid is gap(no block you can fall in that) like [b][b][b][b] [b[e][e][b] [b][b][b][b] b-block e-empty
How are you moving your vehicle? Can i go ahead and guess that you're doing it in Update()
?
void FixedUpdate () {
if (move|| Input.Get$$anonymous$$ey($$anonymous$$eyCode.UpArrow)|| Input.Get$$anonymous$$ey($$anonymous$$eyCode.DownArrow))
{
if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.UpArrow)) forward$$anonymous$$ove = true;
else if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.DownArrow)) forward$$anonymous$$ove = false;
$$anonymous$$oveTank();
}
}
void $$anonymous$$oveTank()
{
if(moveCounter>0)
{
if(forward$$anonymous$$ove)
{
this.GetComponent<Rigidbody>().AddForce(transform.forward * forwardSpeed * 60f * GetForwardSlide() * Time.fixedDeltaTime, Force$$anonymous$$ode.Force);
this.GetComponent<Rigidbody>().AddTorque(transform.up * rotationSpeed * 60f * GetTorqueSlide() * Time.fixedDeltaTime, Force$$anonymous$$ode.Force);
}
else
{
this.GetComponent<Rigidbody>().AddForce(-transform.forward * forwardSpeed * 60f * GetForwardSlide() * Time.fixedDeltaTime, Force$$anonymous$$ode.Force);
this.GetComponent<Rigidbody>().AddTorque(transform.up * rotationSpeed * 60f * GetTorqueSlide() * Time.fixedDeltaTime, Force$$anonymous$$ode.Force);
}
}
}
Answer by Geejayz · Apr 18, 2018 at 03:14 PM
On you vehicle, in the Rigidbody component in the inspector there is an option to freeze rotation. (I don't have Unity open in front of me at present). That should stop the vehicle rotating but could still introduce bouncing depending on your particular situation.
But vehicle must rotate otherwise that is reason why my vehicle have rigibody and not basic position manipulation,but even without x and z rotation i can see error
Your answer
Follow this Question
Related Questions
How to get Satisfying Collision Physics 1 Answer
Realistic kinettic force? 0 Answers
Manually Apply Cars Collision Response Force 0 Answers
Same Collision Rebound Force on Cars 0 Answers
Destructible objects by a projectile 1 Answer