Joh Posted April 6, 2010 Share Posted April 6, 2010 In c++/bmax we use collision callback to have infos from collision wath i should use on lua? Is there any way to create a vector/list on lua? Thx. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Joh Posted April 7, 2010 Author Share Posted April 7, 2010 Anyone known? Seem really strange.. There is nobody who need to check collision on theyr game using lua? I think to have found a sort of solution for list/vector. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
ESP Posted April 7, 2010 Share Posted April 7, 2010 Care to share? Robin Quote Programmer , Intel Quad core, NVIDIA GeForce GT 220, Windows 7 Pro, Galaxy Tab 2 ( 7" and 10"), LE2,LE3,3DWS Link to comment Share on other sites More sharing options...
Joh Posted April 7, 2010 Author Share Posted April 7, 2010 I need to check it before.. Lua array are undefinited, so you can create an array like this: array = {} for i=1, 100 do array[i] = 0 end In this case we could do something like this i guess: Function addLast (a) array[counter] = a counter = counter + 1 end Function removeFirst() a = array[0] for i=0, counter-1 array[i] = array [i+1] end array[counter] = nil counter = counter - 1 return a end I need to check it, it obviously not a list but it can work. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
AndyGFX Posted April 7, 2010 Share Posted April 7, 2010 Lua 5.1 has lib table, which works like TList container: LUA Table Library 1 Quote [HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64 [sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx Link to comment Share on other sites More sharing options...
Joh Posted April 7, 2010 Author Share Posted April 7, 2010 Thx for the answer! Anyway my big problem is about collision as i am making a tool wich need collision.. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Soamp Posted April 7, 2010 Share Posted April 7, 2010 Hi, Table is the best way to go! however you can also use Vec2,Vec3,Vec4 functions to create 2/3/4 dimentional vectors. vec1=Vec3(0,0,0) about collisions, LE have a object:Collision() function that runs when a collision occures. you can use it like this : function object:Collision(entity,position,normal,force,speed) ... end where Entity is the entity that collided this object. you can see "oildrum.lua" (oildrum script) for example 1 Quote Link to comment Share on other sites More sharing options...
Joh Posted April 7, 2010 Author Share Posted April 7, 2010 Yeah i know about vec2 vec3 and vec4, but i was meaning c/c++ vector ( http://www.cplusplus.com/reference/stl/vector/ ) Thx for the collision issue, i didn't found that on oildrum. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Joh Posted April 12, 2010 Author Share Posted April 12, 2010 Mmm seem this doesn't help me at all. What i am trying to do if check if a body (created by code) is collided or not. I don't need to know more other infos, just if it's collided. The oildrum code it's seem a little different it created a class for a model and so took the object and check the collision.. Did i need to create an empty gmf and create a lua file as oildrum have? Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Josh Posted April 15, 2010 Share Posted April 15, 2010 There is a collision object function you can use with models. See the basic Lua tutorial. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Joh Posted April 15, 2010 Author Share Posted April 15, 2010 There is a collision object function you can use with models. That was my tought there is no way to check the collision from the body itself.. To do this i should modify all the models to handle collision with that body OR create an "empty" model to do this.. So for example if i wanna check the collision from 2 bodies created directly on code? Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Josh Posted April 15, 2010 Share Posted April 15, 2010 Use the entity collision callback. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Joh Posted April 15, 2010 Author Share Posted April 15, 2010 mmm how? There is no any docs on it.. I am able to do it on c++ and bmax, but don't know the way to do it on lua.. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.