Jump to content

MexSource

Members
  • Posts

    132
  • Joined

  • Last visited

Everything posted by MexSource

  1. Aggror is it working for you? If, could you please send me your map and the code you used?
  2. Maybe this is because he was in the beta branch and updated the map with it. So maybe your map is no longer compatible with the non beta version edit: This was my 100 post
  3. Hey, Is it possible to move a camera in a direction defined in a Vec3 (a rotation)? Because camera->Pick doesn't work for me i would like to try now world->Pick Tried it like this: if (wd->KeyHit(Key::E)){ Vec3 oldCamPos = cam->GetPosition(); cam->SetInput(cam->GetRotation().y, 5); if (wrd->Pick(oldCamPos, cam->GetPosition(), pickinfo)){ if (pickinfo.entity->GetKeyValue("tag") == "dbutton"){ //pickinfo.entity->SetKeyValue("tag", ""); System::Print("Entity picked, distance: " + String(pickinfo.distance)); //pickinfo.entity->SetPosition(pickinfo.entity->GetPosition().x, pickinfo.entity->GetPosition().y - 2, pickinfo.entity->GetPosition().z); } } cam->SetPosition(oldCamPos); } I think now of the problems with my code is that SetInput uses physics, so my camera object won't go through objects, right? Anyway i have no good idea at the moment, hope anybody can help Lua code is also accepted Btw this is exactly what i want:
  4. I think cassius already found it, he asked for it in another thread (http://www.leadwerks.com/werkspace/topic/9630-leadwerksh/)
  5. Not working, everything the same with the standart barrel included in the models folder
  6. I already attached a lua file, the csg box it's also detected with name. I will try to use a model when I'm back from on school
  7. Ok here some more information: I try to create a game where you need to press a button, i wanted to do this with a raycast This is the pick code, it's from my MainPlayer.cpp "update" function that set up in my App::Loop function: if (wd->KeyHit(Key::E)){ Vec2 mousepos = wd->GetMousePosition(); if (cam->Pick(mousepos.x, mousepos.y, pickinfo, 0)){ if (pickinfo.entity->GetKeyValue("tag") == "dbutton"){ //pickinfo.entity->SetKeyValue("tag", ""); System::Print("Entity picked, distance: " + String(pickinfo.distance)); pickinfo.entity->Hide(); } } } on the map load i set the tag "dbutton" for every object that has "dbutton" in it's name. Later when I did the raycast i would remove the tag so the button is "pressed" (outcommented for testing). It should then print the distance from camera to object. And then the button should be set invisible, so you can see it's pressed. And here are my problems: The line that should output the distance only says -1 everytime and it only works if you are so close to the object, that you are nearly touching it. I will attach my current map. (Maybe it could help) Btw: maybe it's not working because my objects are csg objects? Is this enough explanation or do you need full code? Btw: why can't I upload .map files? map.zip
  8. These variables are no Vec3, they are floats i think and look at the documentation
  9. I already did this sometimes Changing the pickradius to 0 doesn't work too
  10. Hey, I think something ins't functioning properly here. I have this: (In my player class) if (wd->KeyHit(Key::E)){ Vec2 mousepos = wd->GetMousePosition(); if (cam->Pick(mousepos.x, mousepos.y, pickinfo, 0.1)){ if (pickinfo.entity->GetKeyValue("tag") == "dbutton"){ //pickinfo.entity->SetKeyValue("tag", ""); System::Print("Entity picked, distance: " + String(pickinfo.distance)); pickinfo.entity->SetPosition(pickinfo.entity->GetPosition().x, pickinfo.entity->GetPosition().y - 2, pickinfo.entity->GetPosition().z); } } } But it only get triggered if i'm nearly directly in contact with that object. The line System::Print("Entity picked, distance: " + String(pickinfo.distance)); only says: Is that -1 a convert problem or because I'm so close to the object that I'm touching it?
  11. I think when you save a prefab it saves the scripts and all settings too of that model. So you can load that prefab and you already have your script's on it etc.
  12. Oh yes, i just updated steam (maybe the update came here in germany a little bit later) and it works
  13. I have a quick fix for this, it works if you just start the <gamename>.exe manually and not from the editor
  14. I understand. But then i would be at the beginning again, because what i wanted was to not pass that instance around. But i think if i don't want to use globals, that's what i have to do. In my head anyway this seems wrong... But thanks
  15. I have a GameManager.h file like this now: #pragma once #include "Leadwerks.h" using namespace Leadwerks; class GameManager { public: static void initialize(World* world); static Vec3 getRunnerSpawn(); static Vec3 getDeathSpawn(); static Entity* getEntityByName(string name, World* world); }; And these to functions i need to be global (GameManager.cpp) Vec3 GameManager::getRunnerSpawn(){ return RunnerSpawn; } Vec3 GameManager::getDeathSpawn(){ return DeathSpawn; } (Btw: In my game there are two different types of players, the runner's and the death's) On game startup i do this: (GameManager.cpp too) //Load objects list<Entity*>::iterator iter; for (iter = world->entities.begin(); iter != world->entities.end(); ++iter){ Entity* currEnt = (*iter); System::Print("[GameManager] Entity loaded: " + currEnt->GetKeyValue("name")); if (currEnt->GetKeyValue("name") == "runner_spawn"){ RunnerSpawn = currEnt->GetPosition(); } if (currEnt->GetKeyValue("name") == "death_spawn"){ DeathSpawn = currEnt->GetPosition(); } } At the moment i only need this in one function at this position: (Player.cpp) player->SetPosition(GameManager::getRunnerSpawn()); But i will need it definitely more in future. I think i'm going to add more such variables, like the current player amount, the time left etc. to simply use that in all classes
  16. What I wanted to do: On startup I load one entity that I save in an variable because I often need it's position and I need it in every class. I never would change the variable, I only want to read it out from everywhere.
  17. I will tell you tomorrow when I'm back at pc BTW: what's bad with globals? (Never used them before in c++ and on the first look they seem OK)
  18. Yep, i already edited my post, but you were too fast thanks all
  19. i will have a look at them thanks but what are other possibilities, when this is so bad :/? PS: and how is something like Leadwerks::Time::GetCurrent(); made? Is this a singleton too? //After googling a bit i remembered how i did it in java, with static variables and functions. This seems to work here. Would this be a good idea or are the negative aspects?
  20. Hey, I'm trying to create a simple class where i wan't to store much variables (int string float vectors entitys, anything.). But i noticed when i try getting some variables i need to first create a new instance of the class (no idea if i can say it like this, but here's an example for a getter function) i do this: Vec3 getRunnerSpawn(){ return RunnerSpawn; } (the above class is called "GameManager") and to get the vector i need to do this: GameManager gm; gm.getRunnerSpawn(); but i don't won't to create a new instance, because then i would need to create a new instance for every class where i need to use this function. Anyone an idea?..
  21. I would post this as a bug
  22. Hey, I found out that when the editor load a shader it looks like this: and when loading other things e.g. textures/materials: Have you seen this! (if not i will mark it out ) what a pity //I have nothing better to do than post this 'bug'
  23. ok thanks all i hope you're right, because i can't test now
×
×
  • Create New...