
MexSource
Members-
Posts
132 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by MexSource
-
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
-
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:
-
I think cassius already found it, he asked for it in another thread (http://www.leadwerks.com/werkspace/topic/9630-leadwerksh/)
-
Not working, everything the same with the standart barrel included in the models folder
-
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
-
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
-
These variables are no Vec3, they are floats i think and look at the documentation
-
I already did this sometimes Changing the pickradius to 0 doesn't work too
-
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?
-
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.
-
Oh yes, i just updated steam (maybe the update came here in germany a little bit later) and it works
-
I have a quick fix for this, it works if you just start the <gamename>.exe manually and not from the editor
-
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
-
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
-
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.
-
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)
-
Yep, i already edited my post, but you were too fast thanks all
-
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?
-
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?..
-
I would post this as a bug
-
ok thanks all i hope you're right, because i can't test now
-
interesting thanks
-
I think i got it. I tried removing the Time::GetSpeed() completely, because it's not very effective, and i found out that it seems to run perfect. On slow pc's also on fast. I think Josh added this to the UpdatePhysics() function already. Works fine
-
Yep i will do, just need to install bandicam now. Wait, does leadwerks come with video recording? Or only the functon to upload videos? PS: will not do it today (busy with trying to implement raknet)
-
no I think i explained me wrong. I mean the character speed is higher (e.g. he can run faster). What you showed me seems is only something about the debug mode is faster than release mode