Search the Community
Showing results for tags 'PolyMesh'.
-
Leadwerks C++ Noob here... So I'm programmatically creating a bunch of floor tiles out of PolyMesh for my player to walk around on, and it works great except for one strange behavior. When I call Translate() on my tile Model class it slowly erodes/squishes the PolyMesh data until it is gone completely, and then my player just falls through. If I don't translate, no problem. I looked into the docs a bit and I see that PolyMesh isn't recommended for moving objects. However when I try the same with ConvexHull() I am getting no collision data at all. My tiles are basically small flat planes created from 2 triangles to make a rectangle. On create... /* * Generate a cTile * ofs of entire tile position from center * dim is width and length|depth */ Model* make_ctile(Vec3 ofs, Vec3 dim) { Model* cmodel = Model::Create(); cmodel->SetColor(1., 1., 1.); Surface* csurface = cmodel->AddSurface();//Surface::Create();// Vec3 dn = Vec3(0, 1, 0); // up csurface->AddVertex(-dim.x, 0, -dim.y, dn.x, dn.y, dn.z); // bl csurface->AddVertex(dim.x, 0, -dim.y, dn.x, dn.y, dn.z); // br csurface->AddVertex(dim.x, 0, dim.y, dn.x, dn.y, dn.z); // tr csurface->AddVertex(-dim.x, 0, dim.y, dn.x, dn.y, dn.z); // tl // CW csurface->AddTriangle(2, 1, 0); // tr, br, bl csurface->AddTriangle(0, 3, 2); // bl, tl, tr csurface->Update(); csurface->UpdateNormals(); ; Shape* cshape = Shape::PolyMesh(csurface); cmodel->SetShape(cshape); cshape->Release(); cmodel->SetPhysicsMode(Entity::RigidBodyPhysics); cmodel->SetCollisionType(Collision::Prop); ; cmodel->Translate(ofs); return cmodel; } On update... for (int i = 0; i < tilex; i++) { // Pull tiles tiles[i].tile->Translate(0, 0, tile_speed); } Included is a view of the collision working when there is no translation, and also a view of the collision failing after translation has started. I also included a screenshot of the output when I use ConvexHull to generate the shape, which seems to not have any collision data whatsoever. Shape* cshape = Shape::ConvexHull(csurface);// PolyMesh(csurface); I'm not really sure what to try next.
-
I have the Cottages package from the Workshop and try to add a Poly Mesh collider to Cottage 1 or Cottage 2. This appears to work fine: But when I run the game, the outside walls have no collision. Reopening the MDL I find that it is clear they are lacking that part of the collision mesh somehow: Is there any way I can fix this or is it just a bug?
-
Good day everyone Ok, I have this problem... I'm trying to animate a elevator using the sliding door script. When I set the physic shap to box it works, the elevator goes up, but I can't go in (not surprising). When I set my physic shape to polymesh or using my shape file, the elevator dosen't do anything. Why is that ? Any suggestions?
-
Is it possible to create a custom shape for collision without using Shape::PolyMesh(surface)? It seems like a waste creating the surface just to create a shape from it. Can I make the shape in a similar way to creating a surface? Because Shape::PolyMesh is slowing my game down. More Info: I am trying to create a minecraft-like voxel terrain, but I am stuck at performance. I could increase framerate by making the chunks bigger, but then it stutters from the time it takes to create collision. If I reduce the chunk size, it makes collision creation smoother, but the draw calls increases and framerate drops. PS. I've done everything I can to reduce the poly count in the chunks, so there is nothing much I can do to improve things. The only bottleneck I have is the shape creation, which I have no control over. That is why I ask.