-
Posts
45 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Birdman
-
-
I had the 4 LUA lines commented, now i got it workiong, since most scripts were working i didn't cared to check that until now.
Thanks for your response guys.
Edit:This lines were giving me problems with physics in general, vehicle related mostly, there was a script that was messing up my c++ code, thats why i had this lines commented, now i at least found the real problem, and got all working.
-
For the C++ code when using the atmosphere object script, you need to make sure you are passing the framework to the lua state since the script is using the 'fw' framework variable:
The scripts are loading OK, even the Atmosphere object of the Scene is loading, i can check that in the log, i already have that lines of code to setup script, most scripts do their work, except for the skybox.
I will check setting the background but im a bit lost on what im missing to be honest.
-
I have a sbx which haves a skybox that works on the editor, on my c++ code the sky is totally black.
I checked the log and the enviroment object is loading OK.
Also i tried this:
//Set SkyBox
SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"));
It results on the Shader of objects reflecting the Sky, but the sky i still black.
Im using:
TFramework fw=CreateFramework();
TEntity scene=LoadScene("..");
Loop
RenderFramework();
UpdateFramework();
Etc..
Maybe im missing something to initalize the enviroment on the Framework.
Any idea?
-
I think if:
Object* o;
int pointer = *(int*)o;
then
Object* o= (Object*)pointer;
Gotta check this code later.
-
Thanks for the responses guys, i got it working.
I just checked there was a sample in the viper vehicle lua.
object.model:SetKey("collisiontype",COLLISION_PROP) object.model:SetKey("mass",1.0)
C++ Code:
GetEntityKey(model,"mass");
-
If you store it as an entity key..
How do you store an Entity Key in lua?
-
Is there a way to create a variable or property in a class in LUA and access it from C++?
For an instance there switch.lua have a Reset time property created in the Property Dialog, and then in the main function you have a resettime variable. How would i access this property/variable from c++?
Thanks a lot in advance.
-
Any idea on how to generate a simple Traffic Light, with Green, Yellow and Red timed via scripts?
I was trying to figure out how to do this using the switch model .frag and .lua.
-
Yes you are right, this works too:
GetBodyVelocity(chassis,0)
-
I would use a brake force, and just keep applying it until it stops. To keep it from going negative, you could do multiply the vehicle's velocity on it's own z axis by some number between 0 and -1, and that will cause it to gradually slow and stop.
Thanks for your Repply, i don't know where to get the velocity Vector, do you have an idea on how will this be?
I Tried doing something like this but it crashes inside GetBodyVelocity, either using the Chassis object or the vehicle object.
appliedvelocity = (0.2 * GetBodyVelocity(veh,1).Z)*(-1);
Finally CalcBodyVelocity worked with this, idk why GetBodyVelocity Crashes.
Edit: Btw checking the vehicle script i found this code that is used for the decals:
speed = math.abs(self.model:GetVelocity(0).z) speed = (speed - 4) / 120.0 speed = Clamp( speed, 0, 1 ) * 0.05
I will try to convert this to C++ to use to calculate speed.
-
If i use that code my project will close without giving an error. Release or Debug the same.
-
Why this code won't hide my entity?
TModel test=LoadModel("abstract::model.gmf"); .... pivot=FindChild(test,"block"); if (pivot) { HideEntity(pivot); } else { MessageBoxA(0,"block not found.","Error",0); }
All names are OK since pivot is being found OK.
Any idea?
Edit: Block is a mesh inside the model, and i have no way to scale it or hide it. Tried both.
-
Hello,
Since i can't use Joystick for a Driving LUA demo, i made a c++ code that have a running vehicle based on few posts i saw and a rewrite of the original LUA i had.
Im applying Torque to the vehicle this way:
TVehicle veh=CreateVehicle(chassis); ..... TMesh tire[4]; ..... // Torque AddTireTorque(veh, 0, -1); if (KeyDown(KEY_UP)) { if (!TireIsAirborne(tire[0])) AddTireTorque(veh, -24, 0); if (!TireIsAirborne(tire[1])) AddTireTorque(veh, -24, 1); } if (KeyDown(KEY_DOWN)) { if (!TireIsAirborne(tire[0])) AddTireTorque(veh, +24, 0); if (!TireIsAirborne(tire[1])) AddTireTorque(veh, +24, 1); }
I can't seem to find a way to check Tire actual torque to be able apply negative Torque until vehicle is stopped.
I'm applying torque only to wheels 0 and 1 becouse i want a front-wheel drive vehicle.
My idea was to make something like this (Anyway applying 0 torque will do nothing, but if apply negative it will go backwards after stopped):
// BRAKE if (KeyDown(KEY_SPACE)) { if (!TireIsAirborne(tire[0])) AddTireTorque(veh, 0, 0); if (!TireIsAirborne(tire[1])) AddTireTorque(veh, 0, 1); }
Also Is there a way to calculate some kind of speed with raycastvehicle?
Anybody implemented some kind of Engine to do gears and stuff?
Thanks a lot in advance
-
Yeah i think ZioRed answered this, anyway, i have a working LUA for a driving example code, and i have an exe that have joystick implemented, and i cant put em together to work.
Is something simple, but working with leadwerks seems to be far from simple.
What i need is an engine.exe with joystick implemented, my other option is what im finishing now, recoding all my LUA script in c++ becouse im not getting support.
-
Mmm..
What about commented functions like LoadScript, RunScript, etc?
I have Setup LUA OK, but idk how to run a script in my code
TFramework fw = CreateFramework(); SetGlobalObject("fw",fw); BP lua = GetLuaState(); lua_pushobject(lua,fw); lua_setglobal(lua,"fw"); lua_pop(lua,1);
-
Does anybody remeber how to do this?
-
I asked this before, but all my posts are deleted!!!!
What were the lines to initialize lua scripts objects from c++, and to run for an instance FPSController.lua.
Thanks a lot in advance.
Packing scripts folder
in General Discussion
Posted
Hello Soamp, i'm investigating this too, i wasn't able to package the scripts folder.
I have a Data folder with all the models, maps, etc and this works like a charm.
I'm unsure if you can do this without a modification.
This is why i prefer to code most of the important things in c++.
EDIT: What you can do in the worst case is put scripts in the data folder, for an instance i have a specific script inside the model folder, so basically what i have in the scripts folder is all generic Leadwerks stuff.