Collision glitches
Posted: Sat Dec 03, 2016 2:44 am
So I'm using the code below to directly set the linear velocity and a angular velocity of my tank using the user input. The other tank's linear velocity and a angular velocity are being set to zero every frame (as no input is being given).
It works for the most part, but for some reason in a lot of cases, the objects glitch and pass through each other:
https://www.dropbox.com/s/blmg8miftqs56 ... s.mp4?dl=0
I'm using a convex hull for both of the objects, which is set to a convex version of the mesh.
Code: Select all
float mov = Input.GetAxis("Vertical");
float rot = Input.GetAxis("Horizontal");
float movement = mov * (m_Speed);
float aMove = rot * m_TurnSpeed;
bp.Vector3 BPdir = MultiplyQuaternion(BPtankHull.Orientation, new bp.Vector3(0, 0, 1)); // gets transform forward
BPtankHull.LinearVelocity = new bp.Vector3(BPdir.X * movement, BPtankHull.LinearVelocity.Y, BPdir.Z * movement );
BPtankHull.AngularVelocity = new bp.Vector3(0, (rot * m_TurnSpeed), 0);
space.Update(frameDelta);
https://www.dropbox.com/s/blmg8miftqs56 ... s.mp4?dl=0
I'm using a convex hull for both of the objects, which is set to a convex version of the mesh.