Jump to content

Abstergo

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Abstergo

  1. In the UpdatePhysics method for coin, I'd test for the distance between the player's vector and your coin's, then call the function for the pickup when it's in range. I don't know the Lua equivalent but in C++ you'd need to call this: virtual float DistanceToPoint(const Vec3& p); For example: Vec3 v3_first = Vec3(0.0); Vec3 v3_second = Vec3(1.0); v3_first.DistanceToPoint(v3_second); // Will return distance between Vec3(0.0,0.0,0.0) and Vec3(1.0,1.0,1.0)
  2. Hey gang, I'm running into an issue with lighting an object. I have a Model I'm using to produce a floor, which currently just places 10 by 10 1x1 Surfaces in a flat grid. I also have a light hanging overhead, a Spotlight angled straight down in the center. As you can see the light cuts off right down the centerline Z axis of the object, leaving a semicircle illuminated. I initially thought this was tied to specific coordinates, however I get the problem wherever I place the object & light. I've tried a Pointlight, with the same results. The floor is generated in the Attach method of the Model's actor class. Note it creates and attaches a child Model, because this way it can easily be removed and changed on the fly. Model* m_terrain; m_terrain = (Model*)this->entity->FindChild("terrain_model"); if (m_terrain != nullptr) m_terrain->Release(); Texture* t = Texture::Load("Materials/Terrain/terrain_theZone_x2plainmud.tex"); t->SetClampMode(true, true); Shader* s = Shader::Load("Shaders/Model/diffuse.shader"); Material* m = Material::Create(); m->SetShader(s); m->SetTexture(t); m->SetBlendMode(Blend::Solid); m->SetShadowMode(true); m_terrain = Model::Create(this->entity); m_terrain->SetKeyValue("name", "terrain_model"); float x, z; for (x = 0.0; x < 10.0; x++) { for (z = 0.0; z < 10.0; z++) { Surface* sur_face = m_terrain->AddSurface(); sur_face->AddVertex(x, 0.0, z, 0, 0, -1); sur_face->AddVertex(x + 1.0, 0.0, z, 0, 0, -1); sur_face->AddVertex(x + 1.0, 0.0, z + 1.0, 0, 0, -1); sur_face->AddVertex(x, 0.0, z + 1.0, 0, 0, -1); sur_face->SetVertexTexCoords(0, 0, 0, 0); sur_face->SetVertexTexCoords(1, 1, 0, 0); sur_face->SetVertexTexCoords(2, 1, 1, 0); sur_face->SetVertexTexCoords(3, 0, 1, 0); sur_face->AddTriangle(2, 1, 0); sur_face->AddTriangle(0, 3, 2); sur_face->SetMaterial(m); sur_face->Update(); } } m_terrain->SetPosition(Vec3(0.0),false); m_terrain->SetShadowMode(Light::Static); m_terrain->UpdateAABB(Entity::LocalAABB | Entity::GlobalAABB); Anybody got ideas for what I'm doing wrong?
  3. The subject itself is out of my depth, but I'd always stay as close to spec as possible. I don't know how authoritative those individual comments are and what kind of user share they represent, but I'd expect other developers to base their work off the specs, even if initial research yields conflicting information. That is why they exist. If that is the official spec and it covers this question, there is a standard and that is it.
×
×
  • Create New...