Jump to content

Charrua's Blog

Entries in this blog

Simple Car Improved

Now, I wrote a single script that creates suspension, steer and traction You have to create the chassis, 4 wheels, set this script to each one of the wheels and then paly with the configurable parameters. Enjoy: --[[ Autor Juan Ignacio Odriozola (charrua) Purpose: A script that facilitates the making of a simple car all you need is a chassis and 4 wheels assing this scrip to each wheel and set the object chassis then adjust some of the configurable parameters Parent: ch

Charrua

Charrua

Joints

Recently i posted a simple car made with joints without too much explanations... so What is a joint? This video shows joints in action. At the end, the stand alone executable and the complete project.   The following text and figure is from the "ode-latest-userguide", figures are also form the JV-ODE documentation: In real life a joint is something like a hinge, that is used to connect two objects. It is a relationship that is enforced between two bodies so that

Charrua

Charrua

Simple Car

Here there is a way of making a simple car based on hinges This is not a tutorial, is just simply a stating point for the ones that want/like to play arround physics and hinges... I included the entire project and the distribution executable to test the scripts so, you have as I say a starting point and just that, hpe it helps someone This is the editor view and the initial placement of the parts needed Basically I made 3 scripts physicsProperties.lua wheel.l

Charrua

Charrua

LUA CPP "how to" 7/7

6) How to expose a Cpp Class to LUA using tolua++   At a glance:   A way to create instances of objects defined in Cpp from LUA scripts, so functions created in Cpp side should be called from LUA side. Somewhat the opposite direction of items 4, 5 and 6 of this series.   The way is not so difficult once you travelled it, as always!   First you have to write a header with your class declaration, then you have to use tolua++ application to translate it to LU

Charrua

Charrua

LUA CPP "how to" 6/7

5) How to receive returned parameters from LUA functions (yes one or more) come on, every time i edit the post, code /code get bad formatted and have to manually (again) correct it (really don't like to see un-indented code).     So, with an example will see how to receive parameters from LUA function scripts.   The example is basically the same as the one exposed in the previous tut (5/7) the only difference is that the function called has a Return sentence so

Charrua

Charrua

LUA CPP "how to" 5/7

4) How to call an entity's script LUA function passing parameters   following code is some what weird but you only have to pay attention on a few things   the idea is Push the parameters in the order they are declared in the lua function (from left to right) and pay attention in the Interpreter:Invoke method. You have to set the first parameter (number of staked values) one more of the amount of parameters passed.   consider the following LUA function:  

Charrua

Charrua

LUA CPP "how to" 4/7

3) How to call an entity's script LUA function easely (without parameters)   That's really easy. Suppose you have an entity in your scene with a script attached in which a function "noParams" has been declared   function Script:noParams() System:Print("executing noParams") end     using the loop exposed on tut 2/7 of this series, you can find that entity and then, to call one of their functions you only have to do:   entity->CallFunction("noParams");

Charrua

Charrua

LUA CPP "how to" 3/7

2) How to send objects created by Cpp code to LUA   Here is a way of sendign CPP created objects to LUA scripts as GLobal Variables, so any LUA script on you map can simply use it.   I create on cpp: window, world and context and pass them this way:   System::Print("sending objects...."); stacksize = Interpreter::GetStackSize(); Interpreter::PushObject(window); Interpreter::SetGlobal("window"); Interpreter::PushObject(context); Interpreter::SetGlobal("context");

Charrua

Charrua

LUA CPP "how to" 2/7

1) How to get objects created on the editor from Cpp   Easy as it seems, getting an editor created object from cpp code is done basically looping on the entities collection, but there are some things that is good to know.   First one simple way of doing it:   System::Print("start scanning...."); for (auto iter = world->entities.begin(); iter != world->entities.end(); iter++) { Entity* entity = *iter; System::Print(entity->GetKeyValue("name")); if (enti

Charrua

Charrua

LUA CPP bindings "how to" tutorial 1/7

Thnigs i will cover:   1) How to get objects created on the editor from Cpp 2) How to send objects created by Cpp code to LUA 3) How to call an entity's script LUA function easely (without parameters) 4) How to call an entity's script LUA function passing parameters 5) How to receive returned parameters from LUA functions (yes one or more) 6) How to expose a Cpp Class to LUA using tolua++     I will split this post acordingly to the items listed above for easy referencing/reading   H

Charrua

Charrua

×
×
  • Create New...