Jump to content

gamecreator

Members
  • Posts

    4,937
  • Joined

  • Last visited

Everything posted by gamecreator

  1. Ok, thank you. I'll try Line of Sight. The idea is to have a function like SpawnEnemiesAtPivot(pivot, enemytype, numberofenemies) which would spawn enemies on the terrain around the pivot location. The x and z would be random, near the pivot (except avoiding putting enemies on top of each other) but the y would be determined by that pick, so enemies would spawn right on the terrain instead of some arbitrary distance in the air and then fall. Yes, I could just put a bunch of spawn point pivots in an area and that's not the worst idea but that seems less elegant.
  2. I have the following code. player[0].model->Hide(); if(window->KeyHit(Key:) && world->Pick(player[0].controller->GetPosition().x, 100, player[0].controller->GetPosition().z, player[0].controller->GetPosition().x, 1, player[0].controller->GetPosition().z, pickinfo, 0, true, Collision::Scene)) { // 2 is Collision::Scene aka terrain printf("%d hit at %f, %f, %f\n",pickinfo.entity->GetCollisionType(),pickinfo.position.x,pickinfo.position.y,pickinfo.position.z); } player[0].model->Show(); This works perfectly, detecting the position of the terrain with a collision type of 2. However, if I comment out hiding the model, the function will come back with the top of the model's head, about 6 feet higher, and with a collision type of 1 instead of 2. Do I understand the documentation correctly that specifying Collision::Scene (or just 2) should ignore everything except that specific collision type ("if specified, the entity collision type will be tested against this, and only colliding entities will be tested")?
  3. I cleared the code and made a simple moving camera but used the same map and all vegetation was now visible. So it's something in the code that somehow makes the outer vegetation invisible. Couldn't guess what could do that but maybe I'll start pasting code back little by little. If parenting a camera to a pivot could make Shadmar's shaders not work, maybe I'm doing something else Leadwerks doesn't like. Edit: This has something to do with the pivot and/or the controller being near the "edge." I added controls that control just the camera, independent of the pivot/controller. if(window->KeyDown(Key::I)) camera->Move(0, 0, 2.9*Time::GetSpeed(), false); if(window->KeyDown(Key::K)) camera->Move(0, 0, -2.9*Time::GetSpeed(), false); if(window->KeyDown(Key::L)) camera->Move(2.9*Time::GetSpeed(), 0, 0, false); if(window->KeyDown(Key::J)) camera->Move(-2.9*Time::GetSpeed(), 0, 0, false); if(window->KeyDown(Key::Up)) pitch+=0.9*Time::GetSpeed(); if(window->KeyDown(Key::Down)) pitch-=0.9*Time::GetSpeed(); if(window->KeyDown(Key::Right)) yaw+=0.9*Time::GetSpeed(); if(window->KeyDown(Key::Left)) yaw-=0.9*Time::GetSpeed(); camera->SetRotation(pitch, yaw, roll, true); If I bring the character close to the edge, the vegetation doesn't render no matter what. If I take the character/pivot away but bring the camera back, the vegetation does render - all in the same run. Super strange. I was going to redo the camera to not rely on the parenting-to-the-character trick anyway so I think/hope that will solve it.
  4. I copied the Trees folder over to a TreesLeadwerks folder so that I won't get them confused with trees I want to import (TreesPure3D). I suspect you would need to do the same. Attached is the load log from the editor, if it helps. Looking at the log, I did just notice that the tree still pulls materials and textures from the old folder. Shouldn't it be loading it from the current folder first? Probably not related but still a bit strange. I wonder what happens if I delete that old folder... Edit: removing the old folder had Leadwerks checking the current folder, which works. But the vegetation still didn't show up outside of the boundaries. HDEditorLoadLog.txt
  5. In the editor the vegetation seems to display fine. However, when I play in a C++ project, there are "straight" lines of vegetation where the rendering stops. Vegetation does not render roughly when x>100, x<-104, z>95 or z<-107. This is true for both the default trees and bushes (and I assume grass but I did not test that). However, the physics collision for is still there and I bump into invisible trees as I walk with the controller. This is on standard Leadwerks and I just tested it with an updated and rebuilt project with an update I got a few minutes ago. First screenshot is from the editor (showing a flat box I put in for reference. The second and third shots are from in-game with the same box showing in the top-right and then standing on top of in the third. The fourth is where there should be visible trees on the right.
  6. I had various issues with Leadwerks too (post effects not working, still can't figure out how to get glow to work since there's no documentation for the emissive shader, etc.). Was easier to just drop it than to keep fighting it. One day we'll have an engine where you can just write code and supply content and things will just work.
  7. Seems Export doesn't include those. I don't even know how to set the reflection camera scale so I assume it's something Leadwerks did. Still, I appreciate you taking the time to take a look. Thank you.
  8. Thanks. The shader turned my gems invisible since I don't know what texture to use for the emission shader and which slot to put it in (there is no emission slot that I saw). Maybe one day we'll get documentation for this.
  9. Do we have a working glow shader at the moment? I didn't see anything on the workshop. I'm just trying to make items like gems and coins glow. It looks like there was one before but the link doesn't work any more: http://www.leadwerks.com/werkspace/files/file/473-glowmapshaders-leadwerks31/ (Found in this thread.) Thanks.
  10. Broken link for SetRotationSpeed from here: http://www.leadwerks.com/werkspace/page/api-reference/_/lensflare/lensflare-r831 ("Sorry, we couldn't find that!") Also, it would be great to have Lua/C++ examples at least for Create to show usage. Thanks.
  11. Good thought Josh but if I do the camera pivot in App.cpp, it works fine. It's almost as if the pivot being inside a class breaks it (the camera is global). cassius, yeah, that's why I'm not too worried about this. It's just a little bizarre.
  12. I watched the video first and was gonna comment "what kind of sorcery is this?!" but you kind of beat me to it. I had to watch it in slow motion. Rocks looked like they grew and shrunk from the terrain. Even understanding the basics, I'm not quite sure how that happens but I'm happy to settle for sorcery and magic.
  13. Ok. I took the time to create a new project from scratch, new map and for a while the camera parenting and shaders worked fine. But somewhere after I put the camera into the player class, it stopped working. Not sure why. Again, if you comment out the SetParent, it works. Here's the project: http://www.mediafire.com/download/c88y8vof1382ara/ShaderTest.zip Thanks to anyone who can take a look. And in the effort of saving everyone time, here's what player.cpp looks like: #include "world.h" #include "player.h" using namespace Leadwerks; playerclass player[10]; void playerclass::think() { } void playerclass::initialize(float xx, float yy, int which) { x=xx, y=yy; controller = Pivot::Create(); model = Model::Load("Models/fir.mdl"); model->SetParent(controller, false); model->SetRotation(90, 180, 0, true); controller->SetShadowMode(Light::Dynamic); controller->SetPosition(xx, 12, yy, false); // Commented these out for now to make things easier to debug // controller->SetMass(1); // controller->SetPhysicsMode(Entity::CharacterPhysics); camera->SetPosition(xx, 17.5, yy-1.9, true); camera->SetRotation(10, 0, 0); // COMMENT THIS OUT TO GET SHADERS WORKING camera->SetParent(controller, true); } playerclass::playerclass() { x=0.0; y=0.0; speed=1.5; } Thanks!
  14. Have you seen this already? http://www.leadwerks.com/werkspace/blog/170/entry-1496-building-a-network-test-app-with-leadwerks/ Also, Lua is intentionally limited for security reasons but there was talk about adding some more functionalilty (I think for saving and loading data).
  15. Yeah. The parenting is done in the initial setup code. I have this in my main loop to turn the shaders off and on at will: if(window->KeyHit(Key::NumPad1)) camera->AddPostEffect("Shaders/PostEffects/00_Underwater+Caustics.lua"); if(window->KeyHit(Key::NumPad2)) camera->AddPostEffect("Shaders/PostEffects/04_pp_dof.lua"); if(window->KeyHit(Key::NumPad0)) camera->ClearPostEffects(); Works perfectly without the parenting. Mostly doesn't work with it set. Edit: so this may be something to do with the pivot. I'm altering my test code now too and there it works even with the pivot parenting. Bah.
  16. Found out what was causing it. camera->SetParent(controller_pivot, true); I have my camera parented to a controller pivot (to follow behind my character, in third person). As soon as I comment this code out, the shaders work. I can set the camera's position manually, of course, but is there a way to work around this?
  17. Edit: I created a new project and in it the shaders work. So I think I can figure this out. Thanks.
  18. Do shadmar's shaders work properly with the release version? I'm having trouble getting them to work properly outside of the editor.
  19. For what it's worth, you can delete the entire CPP starting code and replace it like you did before. For example, the code from this sample should work fine if pasted over the existing code: http://www.leadwerks.com/werkspace/page/api-reference/_/context/contextdrawrect-r724 Not sure if you want to keep the Lua code around for any reason.
  20. I'm rooting for you Hayden, more so than for myself, on this feature.
  21. Wow. It was the pivot. When I did pivot->SetShadowMode(Light::Dynamic); the shadow came on (regardless of if I did it with the model itself). Very interesting. I don't remember this being needed before but my memory isn't what it once was. Thanks guys.
  22. Great thought. It was static before so I switched it but the moving model still doesn't cast shadows. I did throw the model into the scene just as a sanity check and the standing model does cast a shadow, both in the editor and in the game. The model is parented to a pivot which is a character controller but that shouldn't matter, right?
  23. Seems like this may have come up before but I can't find a solution on the forums or the documentation. I load a map with a default light. The trees and brush and CSG cast shadows correctly. But when I load a model via code, it does not. I've made sure that in the editor the materials are set to cast shadows and the model has a shadow shader and I set the model's SetShadowMode to Light::Dynamic via code right after I load the model. What could I be missing?
×
×
  • Create New...