For some reason, using a triangle mesh causes my tank to fall through terrain.
Convex hull has collisions, but is weirdly off balanced.
SetBox works great, and I will use it if I have to, but it would be nicer to have mesh-based collisions for impacts and the like.
Any idea why this happens?
I’ve modified the raycast vehicle sample.
local node = self.node local hullObject = node:CreateComponent("StaticModel") self.hullBody = node:CreateComponent("RigidBody") local hullShape = node:CreateComponent("CollisionShape") node.scale = Vector3(.01,.01,.01) hullObject.model = cache:GetResource("Model", "Models/hull2.mdl") local material=Material:new() material:SetShaderParameter("MatDiffColor",Variant(Vector4(.05,.1,.05,1))) hullObject:SetMaterial(material) hullObject.castShadows = true hullShape:SetBox(Vector3(500,180,750)) hullShape:SetTriangleMesh(hullObject.model)
- Convex Hull
2 & 3 are with SetBox
- Triangle Mesh falling through the terrain
The mass of the top parts are .01 so as not to affect balance.